aboutsummaryrefslogtreecommitdiff
path: root/test/testsrvr.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/testsrvr.lua')
-rw-r--r--test/testsrvr.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/test/testsrvr.lua b/test/testsrvr.lua
index 3c40840..39fe274 100644
--- a/test/testsrvr.lua
+++ b/test/testsrvr.lua
@@ -3,9 +3,11 @@ port = port or "8080"
3 3
4server, error = socket.bind(host, port) 4server, error = socket.bind(host, port)
5if not server then print("server: " .. tostring(error)) os.exit() end 5if not server then print("server: " .. tostring(error)) os.exit() end
6ack = "\n"
6while 1 do 7while 1 do
7 print("server: waiting for client connection..."); 8 print("server: waiting for client connection...");
8 control = server:accept() 9 control = server:accept()
10 control:setoption("nodelay", true)
9 while 1 do 11 while 1 do
10 command, error = control:receive() 12 command, error = control:receive()
11 if error then 13 if error then
@@ -13,13 +15,12 @@ while 1 do
13 print("server: closing connection...") 15 print("server: closing connection...")
14 break 16 break
15 end 17 end
16 sent, error = control:send("\n") 18 sent, error = control:send(ack)
17 if error then 19 if error then
18 control:close() 20 control:close()
19 print("server: closing connection...") 21 print("server: closing connection...")
20 break 22 break
21 end 23 end
22 print(command);
23 (loadstring(command))() 24 (loadstring(command))()
24 end 25 end
25end 26end