luasocket/test/utestsrvr.lua

18 lines
469 B
Lua
Raw Normal View History

2013-05-30 02:59:28 -07:00
socket=require("socket");
2005-02-08 02:01:01 -08:00
os.remove("/tmp/luasocket")
2013-05-30 02:59:28 -07: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 02:01:01 -08:00
ack = "\n";
while 1 do
print("server: waiting for client connection...");
control = assert(server:accept());
while 1 do
2005-02-08 02:01:01 -08:00
command = assert(control:receive());
assert(control:send(ack));
2013-05-30 02:59:28 -07:00
((loadstring or load)(command))();
2005-02-08 02:01:01 -08:00
end
end