diff options
Diffstat (limited to 'tests/modules/socket/udp/echo_server.lua')
| -rw-r--r-- | tests/modules/socket/udp/echo_server.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/modules/socket/udp/echo_server.lua b/tests/modules/socket/udp/echo_server.lua new file mode 100644 index 000000000..98cf72f7c --- /dev/null +++ b/tests/modules/socket/udp/echo_server.lua @@ -0,0 +1,14 @@ +import("core.base.socket") + +function main() + local sock = socket.udp() + while true do + print("%s: recv ..", sock) + local recv, data, addr, port = sock:recv(8192, {block = true}) + print("%s: recv: %d bytes from: %s:%d", sock, recv, addr, port) + if data then + data:dump() + end + end + sock:close() +end |
