Skip to content

Instantly share code, notes, and snippets.

@cablehead
Created April 20, 2015 22:50
Show Gist options
  • Save cablehead/ff8575e9844048544d87 to your computer and use it in GitHub Desktop.
Save cablehead/ff8575e9844048544d87 to your computer and use it in GitHub Desktop.
local ev = require("ev")
ev.run(function(h)
function echo(conn)
for message in conn do
print("Echo:", message)
end
end
local serve = h.tcp:listen(8000)
while true do
local conn = serve:recv()
h:spawn(echo, conn)
end
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment