Finished implementation of LuaSocket 2.0 alpha on Linux.

Some testing still needed.
This commit is contained in:
Diego Nehab 2003-06-26 18:47:49 +00:00
parent f330540576
commit 71f6bb60bf
41 changed files with 700 additions and 339 deletions

View file

@ -3,9 +3,11 @@ port = port or "8080"
server, error = socket.bind(host, port)
if not server then print("server: " .. tostring(error)) os.exit() end
ack = "\n"
while 1 do
print("server: waiting for client connection...");
control = server:accept()
control:setoption("nodelay", true)
while 1 do
command, error = control:receive()
if error then
@ -13,13 +15,12 @@ while 1 do
print("server: closing connection...")
break
end
sent, error = control:send("\n")
sent, error = control:send(ack)
if error then
control:close()
print("server: closing connection...")
break
end
print(command);
(loadstring(command))()
end
end