I have had trouble connecting to a NodeMCU Server I am running on my ESP-01. I have been trying different variations of the code but my browser always times out. I know I am making a connecting to my ESP because I can see the data of the browser being printed out. Here is the code I am using:
wifi.setmode(wifi.STATION)
wifi.sta.config("SSID","PASSWORD")
wifi.sta.connect()
srv=net.createServer(net.TCP)
srv:listen(80, function(conn)
conn:on("receive",function(conn,payload)
print(payload)
conn:send("<h1>Hello, NodeMCU</h1>")
end)
end)
This is the code straight from the NodeMCU documentation so I'm not sure why I would be having this problem. Any help is greatly appreciated:)
Thanks
Jacob