luasocket/test/utestsrvr.lua

18 lines
469 B
Lua
Raw Permalink Normal View History

2013-05-30 11:59:28 +02:00
socket=require("socket");
2005-02-08 11:01:01 +01:00
os.remove("/tmp/luasocket")
2013-05-30 11:59:28 +02:00
socket.unix = require("socket.unix");
host = host or "luasocket";
server = assert(socket.unix())
assert(server:bind(host))
assert(server:listen(5))
2005-02-08 11:01:01 +01:00
ack = "\n";
while 1 do
print("server: waiting for client connection...");
control = assert(server:accept());
while 1 do
2005-02-08 11:01:01 +01:00
command = assert(control:receive());
assert(control:send(ack));
2013-05-30 11:59:28 +02:00
((loadstring or load)(command))();
2005-02-08 11:01:01 +01:00
end
end