SIM800L HTTP request is not reliable I have a question regarding SIM800L and HTTP GET request. I'm using this https://exploreembedded.com/wiki/Setting_up_GPRS_with_SIM800L simple code to communicate with SIM800l with AT commands. To perform the HTTP request, I use the following set of AT commands:

AT+CFUN=1
OK

AT+CSTT="internet","",""
OK

AT+CIICR
OK

AT+CIFSR
10.180.xxx.xx

AT+CIPSTART="TCP","84.42.xxx.xx",80
OK

CONNECT OK


AT+CIPSEND=52
&gt; 
GET /bakalarka.php/? HTTP/1.1
Host:84.42.xxx.xx



SEND OK
HTTP/1.1 200 OK
Date: Mon, 19 Aug 2019 16:20:27 GMT
Server: Apache
X-Frame-Options: SAMEORIGIN
Vary: Accept-Encoding
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8

10
time201908191820
0



CLOSED


The problem is that sometimes. Or every other time, I don't get the whole HTTP answer. I usually get only the beginning. Something like this:

AT+CIPSEND=52
&gt; 
GET /bakalarka.php/? HTTP/1.1
Host:84.42.xxx.xx



SEND OK
HTTP/1.1 200 OK
Date: Mon, 19 Aug 2019 16:20:27 GMT
Server: Apac


and then after a couple of seconds, the connection closes.

CLOSED


Do you know what could cause that? It's literally random. I need the information from the webpage (it's the current time) and currently, it's really unreliable.

Another question. What does the "10" and "0" mean in the HTTP request? The "time201908191820" is the current time from printed from PHP.

Thank you very much!
Thank you for your answer. The code is as follows:

#include &lt;SoftwareSerial.h&gt;

String Arsp, Grsp;
SoftwareSerial gsm(12, 8); // RX, TX

String GET = "GET /bakalarka.php/? HTTP/1.1\r\nHost:84.42.xxx.xx\r\n\r\n";

void setup() {

  Serial.begin(115200);
  Serial.println("Testing GSM SIM800L");
  gsm.begin(19200);

}

void loop() {

  AT("AT+CFUN=1");
  AT("AT+CSTT=\"internet\",\"\",\"\"");
  AT("AT+CIICR");
  AT("AT+CIFSR");
  AT("AT+CIPSTART=\"TCP\",\"84.42.xxx.xx\",80");

  int get_length;
  get_length = GET.length();

  AT("AT+CIPSEND=" + String(get_length));
  AT(GET);
}

void AT(String AT){

  gsm.println(AT);

  if(gsm.available()){

    Grsp = gsm.readString();
    Serial.println(Grsp);
  }
}


I was thinking about a couple of things that could cause this.
1. Hardware design - some noise could cause a freeze of the GSM module while getting the answer from the server. After thinking through I don't think it's likely to be that. The power supply is made to be really beefy and there are enough bypass caps to reduce the noise and provide enough energy during current spikes. Also, the module doesn't freeze. It's still connected to the server, after a couple of seconds it closes the connection exactly as it should be.


Serial buffer gets somehow full. This was just a quick thought. The buffer of Arduino could get somehow full so it's not able to save any more incoming data. I think it's nonsense, but...


Thank you for your answers.

Krystof