Mercurial > luasocket
comparison test/testsrvr.lua @ 0:4b915342e2a8
LuaSocket 2.0.2 + CMake build description.
author | Eric Wing <ewing . public |-at-| gmail . com> |
---|---|
date | Tue, 26 Aug 2008 18:40:01 -0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4b915342e2a8 |
---|---|
1 socket = require("socket"); | |
2 host = host or "localhost"; | |
3 port = port or "8383"; | |
4 server = assert(socket.bind(host, port)); | |
5 ack = "\n"; | |
6 while 1 do | |
7 print("server: waiting for client connection..."); | |
8 control = assert(server:accept()); | |
9 while 1 do | |
10 command = assert(control:receive()); | |
11 assert(control:send(ack)); | |
12 print(command); | |
13 (loadstring(command))(); | |
14 end | |
15 end |