Skip to content

Instantly share code, notes, and snippets.

@yarinb
Created March 18, 2012 12:13
Show Gist options
  • Save yarinb/2071032 to your computer and use it in GitHub Desktop.
Save yarinb/2071032 to your computer and use it in GitHub Desktop.
LUA IS AWESOME
require "reactor"
require "net"
local buffer = {}
local server = net:server(function(c)
print("connected", c)
c:on("end", function()
print("disconnected")
end)
c:on("data", function(data)
while true do
s,e=str:find("\r?\n")
if not s then break end
print(str:sub(1,s-1))
str=str:sub(e+1)
end
end)
-- local str = ""
-- for i=1,10000 do str = str..i end
-- c:write(str)
end)
local ip, port = server:listen("*", 51111)
reactor.loop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment