Left here for archival purposes.

User avatar
By popcorn
#18483 I'm testing a simple webserver, and the esp is an open wifi spot.

Code: Select allprint("start my esp")
wifi.ap.config({ssid="hello esp"})
gps = ""
co = 0
-- http server
   srv = nil
   srv=net.createServer(net.TCP)
    srv:listen(80,function(conn)
    conn:on("receive",function(conn, payload)
        print(payload)
        conn:send("HTTP/1.1 200 OK\r\n")
        conn:send("Connection:keep-alive\r\n")
        conn:send("Cache-Control: private, no-store\r\n\r\n")
        conn:send("<h1> Hello, I'm here</h1>")
        end)
        conn:on("sent", function(conn) conn:close() end)
    end)


The problem is, on my macbook and Samsung S5 it works fine most of the times.

But on a Motorola G and Samsung S3, a lot of it can't reach 192.168.4.1. Or it takes a long time to connect to wifi. I have to forget the network and reconnect.

I don't know if it is a LUA thing, but it's not working out of the box.

Note: I also tried with pwd. And remove the line:
Code: Select allwifi.ap.config({ssid="jaja"})

And only run the line once.