Unable to post the data to server using GPRS

I am trying to post the data to server using GPRS sim 800A. I am using putty terminal,after CIPSEND command i am entering the data to be posted.I am getting GPRS response as SEND OK but TCP connection is getting closed immediately and i am not getting response from the server.I dont understand why am i not getting response.
Any help would be appreciated…

AT+CGATT=1
OK
AT+CGDCONT=1,"IP","airtelgprs.com"
OK
AT+CSTT="airtelgprs.com"
OK
AT+CIICR
OK
AT+CIFSR
100.123.177.201
AT+CIPSTATUS
OK 
STATE:IP STATUS
AT+CSQ
+CSQ:19,0
OK
AT+CGACT=1
OK
AT+CIPSTART="TCP","serverip","port"
OK
CONNECT OK
AT+CIPSEND
>POST /R111 HTTP/1.1
Host:clientip/port
X-M2M-Origin:XXXX
Content-Type:application/json;ty=1
X-M2M-RI:YYYY
Accept:application/json
{
"m2m:cin":{
"con":"ZZZZ"
}
}
^Z

SEND OK

CLOSED

@RaviPujar sir can you please tell me how to setup tls connection in GPRS?Does SIM 800A has SSL cerificate in it?If i enable SSL function by AT+CIPSSl=1 ,after executing AT+CIPSTART=“TCP”,“ip”,“port” i am getting response as CLOSED OK. It is not connecting to server.

There are direct HTTP AT commands, why are you using HTTP over TCP . Its easier with direct HTTP commands. Does your server support some special protocol which is not possible to use with normal HTTP commands?

Sir,
Our server gives response only when data is sent through TLS connection.For that we are not using any certificates instead we have something called pre shared keys and I am not understanding how to use those keys.If i use HTTP method…

AT+HTTPPARA="USERDATA","deviceip/Resourseid:device port\\r\\npskId:CC2F.in\\r\\npskKey:jghjgh28A\\r\\nX-M2M-Origin:XXXX\\r\\nX-M2M-RI:aaaa\\r\\nCache-Control:no-cache\\r\\nAccept:application/json"

I tried adding PSK in USERDATA only …and I am writing payload part after AT+HTTPDATA=29,40000 …
but at the end i am getting Network error…i,e after AT+HTTPACTION=1…

I tried sending some other data to some other server using TCP normal connection and got it worked.That is why i tried with TCP for sending this data also…but i didn’t get it work.

Did you try adding like this,
AT+HTTPPARA=“USERDATA”,“X-DreamFactory-Api-Key:231344454354”
This should work for single parameter, I don’t know how to add for multiple headers. If its too much custom data, may be HTTP over TCP is better. Forming and sending raw packets over TCP like you were doing earlier.

Also keep in mind that the SIM800 only supports TLS 1.0, maybe your server is rejecting it because it is an insecure standard.

1 Like

Yes, If you need TLS1.2 support SIM800C upgrade to firmware version 1418B06SIM800C32_MCHIP_TLS12 on SIM800C 32M modules. TLS1.2 is not supported on SIM800C 24M modules as this firmware cannot be uploaded in it.