File: testsrvr.lua

package info (click to toggle)
luasocket 2.0.1-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 764 kB
  • ctags: 652
  • sloc: ansic: 3,148; sh: 131; makefile: 89
file content (15 lines) | stat: -rw-r--r-- 403 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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);
        (loadstring(command))();
    end
end