2004-07-18 22:56:14 +00:00
|
|
|
socket = require("socket");
|
|
|
|
host = host or "localhost";
|
2004-11-27 07:58:04 +00:00
|
|
|
port = port or "8383";
|
2004-07-18 22:56:14 +00:00
|
|
|
server = assert(socket.bind(host, port));
|
|
|
|
ack = "\n";
|
2001-01-25 22:00:18 +00:00
|
|
|
while 1 do
|
2002-07-08 21:56:01 +00:00
|
|
|
print("server: waiting for client connection...");
|
2004-07-18 22:56:14 +00:00
|
|
|
control = assert(server:accept());
|
2002-07-08 21:56:01 +00:00
|
|
|
while 1 do
|
2004-07-18 22:56:14 +00:00
|
|
|
command = assert(control:receive());
|
|
|
|
assert(control:send(ack));
|
|
|
|
(loadstring(command))();
|
2002-07-08 21:56:01 +00:00
|
|
|
end
|
2001-01-25 22:00:18 +00:00
|
|
|
end
|