Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] AT+CIPSEND Second time No data sent to the server.

Status
Not open for further replies.

urugn

Newbie level 2
Newbie level 2
Joined
Jul 27, 2013
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
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?

Code:
ati                                                                                                                                                                                                     
SIMCOM_Ltd                                                                                                                                                                                              
SIMCOM_SIM300                                                                                                                                                                                           
Revision:1008B09SIM300M32_SPANSION                                                                                                                                                                      
                                                                                                                                                                                                        
OK

2. Or am i missing something that should tell
Code:
at+cipsend
that data from the server is complete?

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
then i reconnect using
Code:
at+cipstart
and then do
Code:
at+cipsend
again It works.
How do i avoid going round the
Code:
at+cipshut
and
Code:
at+cipstart
again. I thought i should just send at+cipsend and there after i recive the data i do another
Code:
at+cipsend
. I have tried even a
Code:
t+cipsend=5
then
Code:
helo\r
but still the second
Code:
at+cipsend
does not send the data to the server. I thought i should send a terminating character
Code:
\u001a
to the modem from the server but still it behaves the same

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:

Hi again
Some how after restarting the Modem the command
Code:
at+cipsend
works as expected. here is the log

Code:
Welcome to minicom 2.5

OPTIONS: I18n 
Compiled on Feb 24 2011, 11:25:53.
Port /dev/ttyUSB0

Press CTRL-A Z for help on special keys                                                                          
                                                                                                                 
AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0                                                                                 
OK                                                                                                               
ati                                                                                                              
SIMCOM_Ltd
SIMCOM_SIM300
Revision:1008B09SIM300M32_SPANSION

OK
at+cipstatus
OK
                                                                                                                                                                                                        
STATE: IP INITIAL                                                                                                                                                                                       
at+cipstart="tcp","myserver","myserverport"                                                                                                                                                                 
OK                                                                                                                                                                                                      
                                                                                                                                                                                                        
CONNECT OK                                                                                                                                                                                              
at+cipsend=0                                                                                                                                                                                            
ERROR                                                                                                                                                                                                   
at+cipsend                                                                                                                                                                                              
> helo                                                                                                                                                                                                  
SEND OK                                                                                                                                                                                                 
HELO FROM URUGN SYNC                                                                                                                                                                                    
at+cipsend                                                                                                                                                                                              
> helo                                                                                                                                                                                                  
SEND OK                                                                                                                                                                                                 
HELO FROM URUGN SYNC                                                                                                                                                                                    
at+cipsend                                                                                                                                                                                              
> helo                                                                                                                                                                                                  
SEND OK                                                                                                                                                                                                 
HELO FROM URUGN SYNC                                                                                                                                                                                    
at+cipsend                                                                                                                                                                                              
> verify 22560090                                                                                                                                                                                       
SEND OK                                                                                                                                                                                                 
AOKC1                                                                                                                                                                                                   
at+cipsend                                                                                                                                                                                              
> helo                                                                                                                                                                                                  
SEND OK                                                                                                                                                                                                 
HELO FROM URUGN SYNC

Thanks.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top