Sending SMS Through GSM Modem Using AT Commands
Sep 3, 2014Java code to send sms through gsm modem using AT commands..
View RepliesJava code to send sms through gsm modem using AT commands..
View RepliesI have two programs that I'll post below, one is a Server and the other is a Client. The ChatServer runs once and many clients can run ChatClient from separate computers and talk together in their GUI's. The the client program comes with two buttons, one that's simulates the sending of a message to a single user ; "Send Message To User", and one that just generally sends a message ; "Send Message To All". Although now the Clients on the server seem to be able to selectively send messages to an individual by giving the recipient name, all the clients can see that message, which is not exact what I am aiming for. What I am going for is having the "Send Message To User" button click to send a message to the named user without all other users seeing the message.
The Server Program Code
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
[Code] ....
Now I have tried thing like having various input output streams and trying to connect those, but no luck. Tried fiddling with having the names arraylist directing the messages to one client versus all but that did not work out either. How I what I would need to do to go about doing this?
I'm a new in java program. I need reading COM port on GPRS Modem. I plug the GPRS Modem in my PC and it has connected. I use Eclipse and create a project and new a file a.java, i collect this following code from the internet and paste it into the a.java file.
Java Code:
package serial;
import java.io.*;
import java.util.*;
import javax.comm.*; //for accessing serialport
public class OwnPort {
static CommPortIdentifier portId;
[Code] ....
You can see the result here
I don't know the result why return " Set default port to COM4. port COM4 not found."
I am creating an application with having a callerID module. This module is to read calling phone number from modem. I have googled and reference many SerialPort related stuff but could not find a concrete solution. I am able to detect phone ring using serialEvent with javax.comm jar.
I am wondering if AT commands can be used to read/get calling phone number. I also referred following AT commands:
AT+CLIP
AT+VCID
AT+CNUM
1. Is it possible to read calling phone number using AT commands or any other alternative
2. Which AT command can be used and how to send from java application..
I would like my application to execute a command in cmd. The command looks like
start "" /D "C:Riot GamesLeague of LegendsRADSsolutionslol_game_client_sln
elease s .0.1.55deploy"
"League of Legends.exe" "8394" "LoLLauncher.exe" ""
"spectator 95.172.65.26:8088 P3hNrXYZlaM3iJ9ximtzJWHbwLhvbimJ 953089676 EUN1"
So my question is how do I do this?
I tried this, (just copy paste the command):
package MyProject;
import java.io.IOException;
import java.io.InputStream;
public class Cmd {
public static void main(String[] args) {
try {
final Process process = Runtime.getRuntime().exec("start "" /D "C:Riot GamesLeague of
[code]....
I'm using windows.. and our server is UNIX.. I knew that it's possible to create DOS commands in java programs, I have tried it already..
What I want to know is, is it possible to create a java program (from windows) that can execute UNIX command?
Something like: I have a java program in my windows, and it will create a directory in UNIX server /home/dir..
Based on my research, I can connect to our server in command prompt of my windows using ftp <domain> but the commands there is limited.
you need to find out the distance between two trains using only two commands
mf - move forward
mc - move backward
the trains are dropped using helicopter by parachutes . both doesn't know where they are; no gps in the train they are in the same track
write a code to find the trains using the given commands
I have a Java application this application sits on a Dedicated server and gets information about the machine and run commands on the machine.
I need it so that i can run these commands from pressing buttons on a website. For example i press a button to retrieve CPU info, it goes to the app, and the app sends the CPU info back.
I'm fine with the website and app its just the middle bit. How do i get the app to run commands sent from a webpage. Been ratting my brains for a couple weeks now.
I am new to the java computer programming world. i am having basic trouble making the statement full and complete. i am trying to get it to say "The speed of the car is <answer> ft/sec" i have tried reading in the my programming book from school but it doesn't tell me how to fix it. the errors I am getting :
cannot find symbol
I have this error twice ....
For a shool assignment i have to create a java irc client. which responds to commands. the !SENDMSG command has two parameters !SENDMSG <username> <the message>.
i can get the username and the message seperated, but i would like to create a check in case someone gives a bad command like: !SENDMSG" " <-- note te extra spaces, or if someone gives only 1 parameter.
else if (line.contains("!SENDMSG")) {
String str = line.split("!SENDMSG")[1]; //gives: <username> <the message>
String[] parts = line.split("s+");
if (parts.length >= 2) {
String user = parts[4]; //gives the <username>
[code]....
I want to find information about running sudo commands from java, but without gksudo/kdesudo.
This is my code. It works, but after removal "sudo" element.
Java Code:
String array[]={"sudo", "dolphin"};
Process proc = null;
try {
proc = Runtime.getRuntime().exec(array);
}
catch (IOException e) {
e.printStackTrace();
} mh_sh_highlight_all('java');
How I can insert password in this terminal? I tried write pass after array with commands and in, and even in outputstream.
i m working on the SMS receiving using AT Commands using JAVA. i m getting the message of one page correctly using AT commands, but as i increase the size of SMS as 2, 3 or bigger pages the alphabets are converted to some thing like this
+CMGL: 0,"REC UNREAD","+923028910082",,"14/05/10,19:32:40+20"
4469616C202A3334352A393333232061757220536972662052732E3230206D65696E2
0332064696E206B6120696E7465726E65742028333030204D422920686173696C206B
6172656E21207777772E776170747269636B2E636F6D2070657220736F6E6773206175
722067616D657320656E6A6F79206B6172656E212042616C616E636520636865636B2
06B206C7965202A39393923206D69
Whats the problem i m not getting the right text which i have sent through my mobile phone.
My function of receiving SMS is as follows :
public void send(String cmd) {
try {
outputStream.write(cmd.getBytes());
} catch (IOException e) {
e.printStackTrace();
[Code] .....
What I'm supposed to be doing is making it so the program can accept multiple filter and sort commands at one time, and each should be separated by a whitespace.I was thinking about parsing the input again, using whitespace as the delimiter, then normally progressing with each token, as though there was only one command.
However, coding this the way I'm doing it will firstly probably take hours, and secondly, it's likely not even right. I don't have any real way to determine which token contains which data from the Song objects.These are the specific requirements for this portion:A sort/filter command consists of one or more of the following options:
-year:<year(s)>
-rank:<rank(s)>
-artist:<artist>
-title:<title>
-sortBy:<field>
Any number of these options may be given, and they may be given in any order. If multiple options are specified, they will be separated by whitespace.
GazillionSongs Class (the main)
Java Code:
import java.util.*;
import java.io.*;
[code]....
I'm trying to create a code with case commands but it says that public is an illegal start of statement, What do i do?
View Replies View RelatedI have a server with a handful of php services. I communicate with these services by creating connections from java code. The services currently respond with XML, but that can be changed if an alternative way can improve performance.
One of the things I need to do is send varying sized payload (some large) to one of the services. My current plan is to create an xml file in java and perform a POST request with the XML as the payload. I am using an XML because the data is very structured.
From a performance point of view, would it be better to send the XML as a file or just as text? Also, is there a better way to send this data? These services will eventually be used by an android app, where performance and minimizing the size of the data packages will be extremely important.
I did this using ArrayList<String> and my tests worked. Meaning I was able to read the strings in a different class through my constructor. However I want to use a string array because it will be easier to handle when I finish the program. I will send each players poker hand in and figure out who is the winner instead of putting it all onto a ArrayList and having to iterate through it. However whenever I did my check I am just printing null.
PokerFile class
void separateHands(String cards) {
//ArrayList<String>playerOne = new ArrayList<String>();
//ArrayList<String>playerTwo = new ArrayList<String>();
String[] playerOne = new String[10];
String[] playerTwo = new String[10];
[Code] .....
ignore the boolean methods I was just building the structure of the program. The print file is what is outputting this:
null
null
null
null
null
null
public class WinningHand extends PokerFile {
//ArrayList<String> p1 = new ArrayList<String>();
//ArrayList<String> p2 = new ArrayList<String>();
String[] p1 = new String[6];
String[] p2 = new String[6];
WinningHand(String[] p1,String[] p2)
[Code] ....
New to SMSLib. I checked some samples and docs but did not get any ref/poc wherein I can send SMS with following set-up.
1. I want to send SMS from PC which is connected to internet in office network, where I am using proxy settings to connect to internet.(Basically office PC used in LAN environment)
2. I am not sure how to set the Modem settings in this scenario.
3. What i want - want to test SMS functionality in office environment and would like to send SMS to android based mobile using SMSLib library.
4. I have done SMSLib set-up on my PC and have all the required jars/dlls placed at proper location. So no issues related with set-up. Set-up is on windows platform.
5. I have written sample POC by referring some blogs/SMSLib docs. But as mentioned in points 1 and 2 above, am not getting how to write the code.
I am trying send email .So I have downloaded javaEE and javamail jar files and added buildpath.And wrote this code below .But I am getting this exception.
Exception in thread "main" java.lang.RuntimeException: javax.mail.AuthenticationFailedException: 534-5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbskV
534-5.7.14 ggcPi6MBZ4h8CCyCk2TG9EhiTGyE5MVBv7B3k7DsCldqjCuFvMTQG6aAbatrAWggH29muG
534-5.7.14 dzVh1kUYgMgNHAN558QRCnTjrNtUGv34Ul4pzUaansBuBfB0Kpz6_q7JTbrUuAmlZplouA
534-5.7.14 AHDXpFtuCkd-W17tHrZS5mqgVVxAcuKc-7TkhCDGShnfRBWU2R8v-gfvIQShszqsZmCl0i
[Code] .....
What am i missing here.
public static void main(String[] args) {
final String username = "mymail@gmail.com";
final String password = "mypass";
Properties props = new Properties();
props.put("mail.smtp.auth", "true");
[Code] .....
I am new to java (been Reading for 2 days now), and have almost no knowledge on programming (I am a Mechanical Engineer).The problem I have is that I have to upload 5,000 files to a web page (each one is name B001400XXXX.pdf in consecutive order).I have managed to access the web page and select a few form elements using watij, but I am having a hard time sending my pdf file to the server. This is what I have so far:
Java Code:
import org.watij.webspec.dsl.WebSpec;
public class NewClass {
public static void main(String[] args) {
[code]....
I need to send a byte array across a network. I know how to do this. (server->client)
byte[] myArray = new byte[]{0,1,2,3,4,5,6,7,8,9};
DataOutputStream.write(myArray);
... and I know how to receive it.
byte[] myArray = new byte[10];
DataInputStream.read(myArray);
When I send over one of these arrays, it ends up stopping storing values in the array when only about half the array is received, even though the array is sent from the server all at once. This results in the receiver's array, in this case, being something like {1,2,3,4,0,0,0,0,0,0}.
I can easily solve this - and already have - by simply adding a loop onto it and waiting for the bytes to all be received, as the method returns the amount of bytes actually read.
byte[] myArray = new byte[10];
int bytesRead = 0;
while( bytesRead < myArray.length) {
bytesRead += DataInputStream.read( myArray, bytesRead, myArray.length - bytesRead );
}
I am simply wondering if there is a better solution to this, as the current solution isn't that elegant. Did I do something wrong to cause only a part of the array to be sent first? Would it be better to use DataInputStream.readByte() to read off the bytes one by one rather than an array at once, and then store them in an array afterward? Would this cause a performance decrease as each byte is read individually? (I'm sending an array of several million bytes)
I want to send email from my jsp file .. And I have a html code which contains form and inputs. How can I send the email? And I am using netbeans ..
View Replies View RelatedSay I was to make a computer game, the first person to play the game would have a joinable game and would then be the server, and anyone joining in would be the client and the server was updated with JSON data of the clients computer game, and the server would then update each client of each characters new data using JSON, I would need fast multi threaded connection handling with minimum overhead, Is there a specific way to do this? or are there many?
I have realized there are a few ways to send and receive data using UDP and while experimenting I have also found its quite hard to synchronise.
Do I have a connection listening until there is data to be sent and then switched back to listening?
Do I have the server listening for a microsecond and then checking to see of there's anything to send for a microsecond continuously?
Do I have multiple connections for sending and receiving
Do I create new connections for each new and individual packets to be sent and received dynamically on a thread?
What is the optimum most effective way and do my examples reflect much understanding at all? my resent attempts create new problems and rather than re invent the wheel I would like to know what is normally done.
I have a simple class, called InputManager, which has methods that communicate with another class DatabaseManager which has access to Database which is actually object that contains information about actual database.
My JFrame has Navigation class (extends JPanel). There I put all needed JButtons, JLists and so on.. This class has instance of InputManager and when user interacts with GUI components inside of it, Navigation calls InputManager methods, it then analyses the call and calls needed methods on DeviceManager, which then sends queries to Database and etc.
The problem is, that at the beginning (when user runs a program), I want to get information (which is actually values for my GUI components ) from Database. It could, for example, create another DatabaseManager and connect to the Database to get information, but it is okay to have two objects?
I was also thinking about sending same DatabaseManager object through InputManager to Navigation, but it seems strange for me to have two objects, which can interact with each other in both directions(Class A has instance of Class B, and Class B has instance of Class A). Is there anything bad this can do?
Also what I noticed that it seems odd that GUI class would have to get information from database. (Logic in GUI class).
i am having a below piece of code in my worker thread. In my output i am getting xml records from the database. I'm sending this output to a input stream & finally to a sax parser.My query is, before sending to the parser i need to store the input stream in buffer. The buffer should store 1000 records. For every 1000 records the parser should be called from buffer.
while (orset.next()) {
output = orset.getString("xmlrecord");
writeCount++;
InputStream in = new ByteArrayInputStream(output.getBytes("UTF-8"));
InputStream inputStream = new ByteArrayInputStream(output.getBytes("UTF-8"));
Reader reader = new InputStreamReader(inputStream,"UTF-8");
[code]....
I've just recently started playing around with network programming in Java, and I've come up with a simplistic server than can handle multiple clients and return the IP and port each one is connected to (or I'm under the impression that is so). What I've been requested to do as an exercise by one of the programming teachers at my high school (I'm not in a class, this is my own time) is send a message from one client to the other through the ServerSocket so that it may "watch" everything going on. I'm not sure how to go about this at all.
EDIT : now it never seems to go the the else or else if statements...
That is now the main problem. It never, ever, goes past the first if statement, no matter what it is.
EDIT : Okay, I haven't changed a line of code but suddenly not a single if statement is working. They just stopped. The client simply hangs and I can't type anything.
Server
public class Server implements Runnable {
Socket clientSocket;
Server(Socket clientSocket) {
this.clientSocket = clientSocket;
}
public static void main(String args[]) throws Exception {
ServerSocket ssock = new ServerSocket(3480);
System.out.println("Listening on port 3480");
[code]....
I just want to to ask how can I send a form to a servlet using javascript?
Here's my form:
<form id="movieForm" class="form-signin" action="addnewmovie" method="POST"
enctype="multipart/form-data">
<h1 class="text-center movie-title">Add New Movie</h1>
<div class="row">
<div class="col-md-12">
<input id="movieId" type="text" class="input-hide form-control"
placeholder="Movie ID">
[Code] ....
This button will responsible for sending:
<button id="add-new-movie"
class="button-position btn btn-primary btn-block"
type="submit" onClick="submitForm();">Add Movie</button>
Note that I include file uploading in the form.