aboutsummaryrefslogtreecommitdiff
path: root/test/udpconnectclnt.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/udpconnectclnt.lua')
-rw-r--r--test/udpconnectclnt.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/udpconnectclnt.lua b/test/udpconnectclnt.lua
new file mode 100644
index 0000000..effe13a
--- /dev/null
+++ b/test/udpconnectclnt.lua
@@ -0,0 +1,19 @@
1local socket = require"socket"
2local udp = socket.udp
3local localhost = "127.0.0.1"
4local port = arg[1]
5
6se = udp(); se:setoption("reuseaddr", true)
7se:setsockname(localhost, 5062)
8print("se", se:getsockname())
9sc = udp(); sc:setoption("reuseaddr", true)
10sc:setsockname(localhost, 5061)
11print("sc", sc:getsockname())
12
13se:sendto("this is a test from se", localhost, port)
14socket.sleep(1)
15sc:sendto("this is a test from sc", localhost, port)
16socket.sleep(1)
17se:sendto("this is a test from se", localhost, port)
18socket.sleep(1)
19sc:sendto("this is a test from sc", localhost, port)