error send SMS with TCP API
- This topic has 8 replies, 2 voices, and was last updated 9 years, 11 months ago by fleure fleure.
-
AuthorPosts
-
January 20, 2015 at 7:50 am #6169fleure fleureParticipant
can you help me please, j’essaye d’envoyer un sms avec une socket tcp avec le code java mais j’ai toujours un retour err: 609. voici le message que j’envoie:
I try to send a sms with tcp socket with the java code but I still have a return err: 609.
here is the message I send:
/%20sendmsg?user=admin&passwd=mdp&cat=1&enc=1&priority=3&modem=0&to=%22xxxxxxxx%22&text=Hellow.with xxxxxxxx is msisdn number.
thank you.
January 20, 2015 at 7:51 am #6170fleure fleureParticipantcan you help me please,
I try to send a sms with tcp socket with the java code but I still have a return err: 609.
here is the message I send:/%20sendmsg?user=admin&passwd=mdp&cat=1&enc=1&priority=3&modem=0&to=%22xxxxxxxx%22&text=Hellow.
with xxxxxxxx is msisdn number.
thank you.
January 20, 2015 at 8:45 am #6172Bryon DavisModeratorHi fleure,
Everything looks ok, but there shouldn’t be a %20 (space) between the / and sendmsg?Try:
/sendmsg?user=admin&passwd=mdp&cat=1&enc=1&priority=3&modem=0&to=%22xxxxxxxx%22&text=Hellow.
Regards,
BryonJanuary 20, 2015 at 9:00 am #6175fleure fleureParticipantthank you Bryon, i try this also but a have the same error ( Err: 609).
January 20, 2015 at 9:06 am #6176Bryon DavisModeratorThe 609 error indicates that there was “Timeout waiting for a TCP API request”.
The “/sendmsg?user=admin&passwd=mdp&cat=1&enc=1&priority=3&modem=0&to=%22xxxxxxxx%22&text=Hellow.” request must end with a carriage return and linefeed. Otherwise the iSMS will wait for more data and eventually timeout.
January 20, 2015 at 9:27 am #6177fleure fleureParticipanti have the same error.
this is the java code ( i get the first line of response):Socket socket=new Socket(ipAdress,2040);
socket.setSoTimeout(0);
String sms=”sendmsg?user=admin&passwd=mdp&cat=1&enc=1&priority=3&modem=0&to=%22xxxxxxxx%22&text=HellowviaCode\n”;
BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream()));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(s.getOutputStream()));
bw.write(sms);
bw.flush();
String line;
StringBuffer Response = new StringBuffer();
int lineNumber=0;
while ((line = br.readLine()) != null) {
System.out.println( “Received line iSMS :”+ line);
if(line.equals(“”)){
System.out.println( “end Response “);
break;
}
if(lineNumber==0){
Response.append(line);
break;
}
else Response.append(line).append(“\n”);
}
String responseBody = Response.toString();
System.out.println( “responseBody “+responseBody);
bw.close();
br.close();
s.close();January 20, 2015 at 9:57 am #6178Bryon DavisModeratorTry changing the following line to end with “\r\n” (carriage return and linefeed):
socket.setSoTimeout(0); String sms=”sendmsg?user=admin&passwd=mdp&cat=1&enc=1&priority=3&modem=0&to=%22xxxxxxxx%22&text=HellowviaCode\r\n”;
January 20, 2015 at 10:10 am #6179fleure fleureParticipanti have Err:602 (parse Error).
January 20, 2015 at 10:14 am #6180fleure fleureParticipanti have a response now with :
String sms=”/sendmsg?user=admin&passwd=mdp&cat=1&enc=1&priority=3&modem=0&to=%22xxxxxx%22&text=HellowviaCode\r\n”;thank you frends for your help.
-
AuthorPosts
- You must be logged in to reply to this topic.