File: testsrvr.lua

package info (click to toggle)
luasocket 2.0.2-4
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 752 kB
  • ctags: 639
  • sloc: ansic: 3,063; sh: 138; makefile: 87
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