-->
Page 3 of 6

Re: Browser or server problem ?

PostPosted: Wed Mar 04, 2015 11:11 am
by jpe
It's safari. It waits for something it never gets. What I have no idea.
I have to use Chrome.

Re: Browser or server problem ?

PostPosted: Wed Mar 04, 2015 11:42 am
by Pram
MK1888 wrote:Lesson #1 in troubleshooting: Start with the simplest configuration that works and then move up in complexity.

You have a bunch of things going on. Get a very simple webserver working first. Can you serve HTML to your Safari browser? Like this: <html><body><h1>blah</h1></body></html>

Then add things one at a time until it breaks.

EDIT: By the way...the HTML that you are producing in your last post is not valid. You can't start an HTML page with <font>.


So now I just tried <html><body><h1>blah</h1></body></html>, but Safari could noct open it. I also edited my code and put in <html><body> at the beginning and </body></html> at the end.

Re: Browser or server problem ?

PostPosted: Wed Mar 04, 2015 4:49 pm
by MK1888
Simple web server:

Code: Select allwifi.ap.config({ssid="NODEDUINO",pwd=""})
wifi.setmode(wifi.SOFTAP)

if srv then
   srv:close()
end
srv=net.createServer(net.TCP,30)
srv:listen(80,function(conn)
   conn:on("receive",function(conn, payload)
      print(payload)
      if string.sub(payload, 1, 6) == 'GET / ' then
         conn:send("HTTP/1.1 200 OK\r\n")
         conn:send("<html><body><h1>ESP8266 Web Server</h1></body></html>")
      end
   end)
   conn:on("sent",function(conn)
      conn:close()
   end)
end)

Re: Browser or server problem ?

PostPosted: Mon Mar 09, 2015 1:56 pm
by dadangluki
You need to send HTTP header first, like this:

HTTP/1.1 200 OK
Connection: close
Content-Length: 48

<HTML>
<BODY>
Hallo World
<BoDY>
</HTML>



Check this link: http://en.wikipedia.org/wiki/Hypertext_ ... r_Protocol