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/tcp/file_client.lua | |
| parent | 60c78f84bcef3be6e5a906cd10fe6bc0d7b0c77c (diff) | |
improve socket
Diffstat (limited to 'tests/modules/socket/tcp/file_client.lua')
| -rw-r--r-- | tests/modules/socket/tcp/file_client.lua | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/tests/modules/socket/tcp/file_client.lua b/tests/modules/socket/tcp/file_client.lua index 92d62976b..27dccfc7d 100644 --- a/tests/modules/socket/tcp/file_client.lua +++ b/tests/modules/socket/tcp/file_client.lua @@ -11,13 +11,12 @@ function main() local recv = 0 local data = nil local wait = false - local results = {} + local buff = bytes(8192) while true do - real, data = sock:recv(8192) + real, data = sock:recv(buff, 8192) if real > 0 then recv = recv + real wait = false - table.insert(results, data) elseif real == 0 and not wait then if sock:wait(socket.EV_RECV, -1) == socket.EV_RECV then wait = true @@ -28,9 +27,6 @@ function main() break end end - if #results > 0 then - data = bytes(results) - end - print("%s: recv ok, size: %d, #data: %d!", sock, recv, data and data:size() or 0) + print("%s: recv ok, size: %d!", sock, recv) sock:close() end |
