diff options
| author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2003-06-26 18:47:49 +0000 |
|---|---|---|
| committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2003-06-26 18:47:49 +0000 |
| commit | 71f6bb60bf2b7457091c7106190f92ab7e51f7c6 (patch) | |
| tree | 8ad3668667bd3da3c34f7ff7ae0a9a7a4daa4679 /test/testsrvr.lua | |
| parent | f330540576031528f0daac231c61d4dd06e8ba1e (diff) | |
| download | luasocket-71f6bb60bf2b7457091c7106190f92ab7e51f7c6.tar.gz luasocket-71f6bb60bf2b7457091c7106190f92ab7e51f7c6.tar.bz2 luasocket-71f6bb60bf2b7457091c7106190f92ab7e51f7c6.zip | |
Finished implementation of LuaSocket 2.0 alpha on Linux.
Some testing still needed.
Diffstat (limited to 'test/testsrvr.lua')
| -rw-r--r-- | test/testsrvr.lua | 5 |
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 | ||
| 4 | server, error = socket.bind(host, port) | 4 | server, error = socket.bind(host, port) |
| 5 | if not server then print("server: " .. tostring(error)) os.exit() end | 5 | if not server then print("server: " .. tostring(error)) os.exit() end |
| 6 | ack = "\n" | ||
| 6 | while 1 do | 7 | while 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 |
| 25 | end | 26 | end |
