File: utestsrvr.lua

package info (click to toggle)
luasocket 3.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,264 kB
  • sloc: ansic: 4,845; makefile: 337; sh: 116
file content (17 lines) | stat: -rw-r--r-- 469 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
socket=require("socket");
os.remove("/tmp/luasocket")
socket.unix = require("socket.unix");
host = host or "luasocket";
server = assert(socket.unix())
assert(server:bind(host))
assert(server:listen(5))
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));
        ((loadstring or load)(command))();
    end
end