1

I use Jerry's code from this topic in a context where the response is very short, to read a sensor with an esp8266 module. And I get a response after a delay of about 4 seconds. Yet with CURL command like: curl myip/?myQuery, I get the answer in less than a second.

Can someone explain to me why ?

Community
  • 1
  • 1
kik
  • 11
  • 2
  • No, no one can explain details of the server's behavior without details of its implementation. I *speculate*, however, that the difference relates to the fact that Jerry's code emits a malformed HTTP request. Well-formed HTTP request lines are terminated by carriage-return / line-feed *pairs* (`\r\n`), but Jerry's code uses bare line feeds. The server might therefore wait for a time, expecting the rest of the message, before ultimately falling back to an error-handling strategy that happens to interpret the message as intended. – John Bollinger Aug 07 '15 at 17:52
  • 1
    Thank you John, you are right, it was just the \r\n missing. The answer is instantaneous with it. – kik Aug 08 '15 at 14:47

0 Answers0