diff options
Diffstat (limited to 'tests/modules/socket/tcp/echo_server.lua')
| -rw-r--r-- | tests/modules/socket/tcp/echo_server.lua | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/modules/socket/tcp/echo_server.lua b/tests/modules/socket/tcp/echo_server.lua index 76aa9dfb6..a047aa15f 100644 --- a/tests/modules/socket/tcp/echo_server.lua +++ b/tests/modules/socket/tcp/echo_server.lua @@ -1,15 +1,18 @@ import("core.base.socket") function main() - local sock = socket.bind("127.0.0.1", 9001) + local addr = "127.0.0.1" + local port = 9001 + local sock = socket.bind(addr, port) sock:listen(20) local sock_client = nil while true do + print("%s: listening %s:%d ..", sock, addr, port) local ok = sock:wait(socket.EV_ACPT, -1) if ok == socket.EV_ACPT then sock_client = sock:accept() if sock_client then - print(sock_client) + print("%s: accepted", sock_client) sock_client:close() end end |
