0
\$\begingroup\$

I recently started working on a project in which I am using an ESP8266 to receive data from my computer or mobile phone. I do the following to set my ESP8266 as a server.

AT+CWMODE=2 //makes the module a AP
AT+CIPMUX=1 //enables multiple connections (needed for the next command)
AT+CIPSERVER=1,80 //starts a server and opens port 80

Now, incomming requests (going to the modules ip-adress in a webbrowser) will be send through the modules serial out:

IPD,0,412:GET /index.php HTTP/1.1
Host: 192.168/4.1

My only issue is that the webbrowser will keep on loading, because it is not getting any response from the server it is trying to reach. I would like the module to be able to send an 'OK' back to the computer so it knows it doesn't have to resend its data. I have tried using

AT+CIPSEND=<id>,2,"OK"

but I haven't got any luck so far..

Does anyone know how this could be done?

\$\endgroup\$
0

1 Answer 1

1
\$\begingroup\$

you will have to reply with a full HTTP header. Something like:

HTTP/1.1 200 OK<\r><\n>
Content-Length: 0<\r><\n>  
<\r><\n>

The TSP8266 doesn't seem to support HTTP, so you'll have to either send this response via UART for every connection or you write a firmware for the ESP8266 that has a (partly) functioning webserver.

\$\endgroup\$
8
  • \$\begingroup\$ Then it has nothing to do with electronics. It is programming :) RTFM! I even did not think that it can be that developer waits to load web page without implementing its sending from another side \$\endgroup\$
    – Anonymous
    Commented Oct 10, 2016 at 16:26
  • \$\begingroup\$ That sounds logical, but my question remains: how would you do so? I have no idea how to send the data back to the computer. \$\endgroup\$ Commented Oct 10, 2016 at 16:28
  • \$\begingroup\$ Well if I put this on stackoverflow they will redirect me to electronics... but yeah, I will try. \$\endgroup\$ Commented Oct 10, 2016 at 16:42
  • \$\begingroup\$ Are you connected to the ESP via UART? \$\endgroup\$
    – Felix S
    Commented Oct 10, 2016 at 16:49
  • \$\begingroup\$ @MerijnDenHouting there's intersection of 3 directions: HTTP protocol if you are unsure what server should answer to client, ESP8266 programming if you do not know how to tackle chip's registers/commands, and physical connection of parts and interfacing, which is electronics. Where does your issue lie in? Probably you need to formulate question differently to get appropriate answer. \$\endgroup\$
    – Anonymous
    Commented Oct 10, 2016 at 17:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.