summaryrefslogtreecommitdiff
path: root/tests/modules/socket/udp/echo_client.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tests/modules/socket/udp/echo_client.lua')
-rw-r--r--tests/modules/socket/udp/echo_client.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/modules/socket/udp/echo_client.lua b/tests/modules/socket/udp/echo_client.lua
new file mode 100644
index 000000000..2c628cc92
--- /dev/null
+++ b/tests/modules/socket/udp/echo_client.lua
@@ -0,0 +1,10 @@
+import("core.base.socket")
+
+function main()
+ local addr = "127.0.0.1"
+ local port = 9001
+ local sock = socket.udp()
+ local send = sock:sendto("hello world..", addr, port, {block = true})
+ print("%s: send to %s:%d %d bytes!", sock, addr, port, send)
+ sock:close()
+end