Created
April 20, 2015 22:50
-
-
Save cablehead/ff8575e9844048544d87 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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