summaryrefslogtreecommitdiff
path: root/tests/modules/socket/tcp/echo_client.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-04-06 22:39:09 +0800
committerruki <[email protected]>2022-04-06 22:39:09 +0800
commitcc8c6dee305ab37f2ba18bbd4d04cc62ad0a9f2e (patch)
treeb3d9c336d7beb6d72285925442aecddc004c2706 /tests/modules/socket/tcp/echo_client.lua
parent60c78f84bcef3be6e5a906cd10fe6bc0d7b0c77c (diff)
improve socket
Diffstat (limited to 'tests/modules/socket/tcp/echo_client.lua')
-rw-r--r--tests/modules/socket/tcp/echo_client.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/modules/socket/tcp/echo_client.lua b/tests/modules/socket/tcp/echo_client.lua
index 55613cd10..bb2853c95 100644
--- a/tests/modules/socket/tcp/echo_client.lua
+++ b/tests/modules/socket/tcp/echo_client.lua
@@ -1,3 +1,4 @@
+import("core.base.bytes")
import("core.base.socket")
function main()
@@ -8,10 +9,11 @@ function main()
if sock then
print("%s: connected!", sock)
local count = 0
+ local buff = bytes(8192)
while count < 10000 do
local send = sock:send("hello world..", {block = true})
if send > 0 then
- sock:recv(13, {block = true})
+ sock:recv(buff, 13, {block = true})
else
break
end