From 71f6bb60bf2b7457091c7106190f92ab7e51f7c6 Mon Sep 17 00:00:00 2001 From: Diego Nehab Date: Thu, 26 Jun 2003 18:47:49 +0000 Subject: Finished implementation of LuaSocket 2.0 alpha on Linux. Some testing still needed. --- test/testclnt.lua | 28 +++++++++++++++++++--------- test/testsrvr.lua | 5 +++-- 2 files changed, 22 insertions(+), 11 deletions(-) (limited to 'test') diff --git a/test/testclnt.lua b/test/testclnt.lua index b2b4b18..e38c248 100644 --- a/test/testclnt.lua +++ b/test/testclnt.lua @@ -17,12 +17,14 @@ function warn(...) io.write("WARNING: ", s, "\n") end +pad = string.rep(" ", 8192) + function remote(...) local s = string.format(unpack(arg)) s = string.gsub(s, "\n", ";") s = string.gsub(s, "%s+", " ") s = string.gsub(s, "^%s*", "") - control:send(s, "\n") + control:send(pad, s, "\n") control:receive() end @@ -82,16 +84,19 @@ function reconnect() remote [[ if data then data:close() data = nil end data = server:accept() + data:setoption("nodelay", true) ]] data, err = socket.connect(host, port) if not data then fail(err) else pass("connected!") end + data:setoption("nodelay", true) end pass("attempting control connection...") control, err = socket.connect(host, port) if err then fail(err) else pass("connected!") end +control:setoption("nodelay", true) ------------------------------------------------------------------------ test("method registration") @@ -157,16 +162,21 @@ remote "data:send(str); data:close()" end -test_mixed(1) -test_mixed(17) -test_mixed(200) +--test_mixed(1) +--test_mixed(17) +--test_mixed(200) +--test_mixed(4091) +--test_mixed(80199) +--test_mixed(4091) +--test_mixed(200) +--test_mixed(17) +--test_mixed(1) + +test_mixed(4091) +test_mixed(4091) +test_mixed(4091) test_mixed(4091) -test_mixed(80199) test_mixed(4091) -test_mixed(200) -test_mixed(17) -test_mixed(1) - ------------------------------------------------------------------------ test("character line") reconnect() 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" server, error = socket.bind(host, port) if not server then print("server: " .. tostring(error)) os.exit() end +ack = "\n" while 1 do print("server: waiting for client connection..."); control = server:accept() + control:setoption("nodelay", true) while 1 do command, error = control:receive() if error then @@ -13,13 +15,12 @@ while 1 do print("server: closing connection...") break end - sent, error = control:send("\n") + sent, error = control:send(ack) if error then control:close() print("server: closing connection...") break end - print(command); (loadstring(command))() end end -- cgit v1.2.3-55-g6feb