Sample code:
srv=net.createServer(net.TCP)
srv:listen(81,function(conn)
conn:on("receive", function(client,request)
local buf = ""
local _, _, method, path, vars = string.find(request, "([A-Z]+) (.+)?(.+) HTTP")
if(method == nil)then
_, _, method, path = string.find(request, "([A-Z]+) (.+) HTTP")
end
local _GET = {}
if (vars ~= nil)then
for k, v in string.gmatch(vars, "(%w+)=(%w+)&*") do
_GET[k] = v
end
end
...and then I fill the buffer and send response...
client:send(buf);
client:close();
collectgarbage();
end)
end)
Internet Explorer and my phone's built-in browser app "Internet" both work fine when connecting to port 81, it's just Chrome that won't display the page when connecting to other than port 80.
Anyone have any ideas on how NodeMCU can respond correctly to Chrome browser on other than port 80?