The link you provided works fine on port 81 ie. This webserver code works:
-- a simple HTTP server
srv = net.createServer(net.TCP)
srv:listen(81, function(conn)
conn:on("receive", function(sck, payload)
print(payload)
sck:send("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n<h1> Hello, NodeMCU.</h1>")
end)
conn:on("sent", function(sck) sck:close() end)
end)
But this code does NOT work when listening on port 81. It is from the NodeMCU net.createserver documentation and is what I based my code on haha
-- server listens on 81, if data received, print data to console and send "hello world" back to caller
-- 30s time out for a inactive client
sv = net.createServer(net.TCP, 30)
function receiver(sck, data)
print(data)
sck:close()
end
if sv then
sv:listen(81, function(conn)
conn:on("receive", receiver)
conn:send("hello world")
end)
end