diff options
| author | ruki <[email protected]> | 2022-04-06 22:39:09 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-04-06 22:39:09 +0800 |
| commit | cc8c6dee305ab37f2ba18bbd4d04cc62ad0a9f2e (patch) | |
| tree | b3d9c336d7beb6d72285925442aecddc004c2706 /tests/modules/socket/unix_tcp/echo_client.lua | |
| parent | 60c78f84bcef3be6e5a906cd10fe6bc0d7b0c77c (diff) | |
improve socket
Diffstat (limited to 'tests/modules/socket/unix_tcp/echo_client.lua')
| -rw-r--r-- | tests/modules/socket/unix_tcp/echo_client.lua | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/modules/socket/unix_tcp/echo_client.lua b/tests/modules/socket/unix_tcp/echo_client.lua index 27c88cb9f..177f2ef48 100644 --- a/tests/modules/socket/unix_tcp/echo_client.lua +++ b/tests/modules/socket/unix_tcp/echo_client.lua @@ -1,8 +1,10 @@ +import("core.base.bytes") import("core.base.socket") function main(addr) addr = addr or path.join(os.tmpdir(), "echo.socket") print("connect %s ..", addr) + local buff = bytes(8192) local sock = socket.connect_unix(addr) if sock then print("%s: connected!", sock) @@ -10,7 +12,7 @@ function main(addr) 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 |
