mirror of
https://github.com/lunarmodules/luasocket.git
synced 2024-11-08 22:38:21 +01:00
16 lines
391 B
Lua
16 lines
391 B
Lua
socket = require("socket");
|
|
host = host or "localhost";
|
|
port = port or "8383";
|
|
server = assert(socket.bind(host, port));
|
|
ack = "\n";
|
|
while 1 do
|
|
print("server: waiting for client connection...");
|
|
control = assert(server:accept());
|
|
while 1 do
|
|
command = assert(control:receive());
|
|
assert(control:send(ack));
|
|
print(command);
|
|
(load(command))();
|
|
end
|
|
end
|