urugn
Newbie level 2
- Joined
- Jul 27, 2013
- Messages
- 2
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 20
Hi. I have been working on a GPRS project. where i need to send data to a server. I have written a custom server in jave via the BufferedInputStream and BufferedOutputStream.
On the client side i connect just fine with AT+CIPSTART and i then send the data. The problem is when i initialize the at+cipsend command a second time and send the data. Nothing happens. The same works perfectly well when i connect using telnet i can send the data as many time as possible. My questions are:
1. Is it the firmware of my modem may be i need to upgrade it?
2. Or am i missing something that should tell
that data from the server is complete?
Here is a log for modem
I get TCP ERROR: 12 sometime but there is no data sent to the server the second time. but if i do
then i reconnect using
and then do
again It works.
How do i avoid going round the
and
again. I thought i should just send at+cipsend and there after i recive the data i do another
. I have tried even a
then
but still the second
does not send the data to the server. I thought i should send a terminating character
to the modem from the server but still it behaves the same
Here is the code i use on the server.
The output of the server is as follows
If i connect through my nokia 6630 to the internet and do the use telnet to connect to the server everything works as expected. That is i can send helo as many times as possible to the server using telnet through nokia 6630.
Kindly advice me on what to do. Thanks in advance.
On the client side i connect just fine with AT+CIPSTART and i then send the data. The problem is when i initialize the at+cipsend command a second time and send the data. Nothing happens. The same works perfectly well when i connect using telnet i can send the data as many time as possible. My questions are:
1. Is it the firmware of my modem may be i need to upgrade it?
Code:
ati
SIMCOM_Ltd
SIMCOM_SIM300
Revision:1008B09SIM300M32_SPANSION
OK
2. Or am i missing something that should tell
Code:
at+cipsend
Here is a log for modem
Code:
at+cipstart="tcp","myserverip","myport"
OK
CONNECT OK
at+cipsend
> helo
SEND OK
HELO FROM URUGN SYNC
at+cipsend
> helo
TCP ERROR: 12
I get TCP ERROR: 12 sometime but there is no data sent to the server the second time. but if i do
Code:
at+cipshut
Code:
at+cipstart
Code:
at+cipsend
How do i avoid going round the
Code:
at+cipshut
Code:
at+cipstart
Code:
at+cipsend
Code:
t+cipsend=5
Code:
helo\r
Code:
at+cipsend
Code:
\u001a
Here is the code i use on the server.
Code:
BufferedOutputStream ostream;
BufferedInputStream istream.
............
List<Character> s = new ArrayList<Character>();
while (!stop) {
char c = '0';
while (((r = istream.read())) != -1) {
c = (char) r;
System.out.println(" CHAR: " + Integer.toHexString(c));
s.add(c);
if (c == '\r' || c == '\n') {//DETECT A CARRAGE RETURN or a NEW LINE
break;
}
}
//parse the characters into a string
String req = "";
for (int i = 0; i < s.size(); i++) {
req += s.get(i);
}
if (req != null && !req.trim().equals("")) {
System.out.println(" REQ: " + req);
req = req.trim();
if (req.equalsIgnoreCase("helo")) {
char[] ch = "HELO FROM URUGN SYNC".toCharArray();
for (int i = 0; i < ch.length; i++) {
ostream.write(ch[i]);
}
ostream.write('\r');
ostream.write('\n');
ostream.flush();
}
}
req = "";
s.clear();
}
...........
The output of the server is as follows
Code:
CHAR: 68
CHAR: 65
CHAR: 6c
CHAR: 6f
CHAR: d
REQ: helo
If i connect through my nokia 6630 to the internet and do the use telnet to connect to the server everything works as expected. That is i can send helo as many times as possible to the server using telnet through nokia 6630.
Kindly advice me on what to do. Thanks in advance.
Last edited: