Skip to content

Instantly share code, notes, and snippets.

@smcl
Created February 7, 2016 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smcl/a307f4b66278d7a0653d to your computer and use it in GitHub Desktop.
Save smcl/a307f4b66278d7a0653d to your computer and use it in GitHub Desktop.
--wifi.setmode(wifi.STATION)
--wifi.sta.config("MyAccessPoint","mypassword")
hits = 0
server = net.createServer(net.TCP)
server:listen(80, function(conn)
conn:on("receive", function(conn, payload)
print(payload)
hits = hits + 1
html = string.format("<html><body>You are visitor number <strong>%s</strong></body></html>", hits)
conn:send(html)
conn:close()
end)
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment