diff options
Diffstat (limited to 'ThirdParty/luasocket/test/testsrvr.lua')
-rw-r--r-- | ThirdParty/luasocket/test/testsrvr.lua | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/ThirdParty/luasocket/test/testsrvr.lua b/ThirdParty/luasocket/test/testsrvr.lua new file mode 100644 index 0000000..1eb2d5b --- /dev/null +++ b/ThirdParty/luasocket/test/testsrvr.lua @@ -0,0 +1,20 @@ +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, emsg = control:receive(); + if emsg == "closed" then + control:close() + break + end + assert(command, emsg) + assert(control:send(ack)); + print(command); + ((loadstring or load)(command))(); + end +end |