aboutsummaryrefslogtreecommitdiff
path: root/samples/echosrvr.lua
diff options
context:
space:
mode:
Diffstat (limited to 'samples/echosrvr.lua')
-rw-r--r--samples/echosrvr.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/samples/echosrvr.lua b/samples/echosrvr.lua
index 127ccb8..a7ed03c 100644
--- a/samples/echosrvr.lua
+++ b/samples/echosrvr.lua
@@ -12,11 +12,12 @@ if arg then
12end 12end
13print("Binding to host '" ..host.. "' and port " ..port.. "...") 13print("Binding to host '" ..host.. "' and port " ..port.. "...")
14udp, err = socket.udp() 14udp, err = socket.udp()
15if not udp then print(err) os.exit() end 15assert(udp, err)
16err = udp:setsockname(host, port) 16ret, err = udp:setsockname(host, port)
17if err then print(err) os.exit() end 17assert(ret, err)
18udp:timeout(5) 18udp:settimeout(5)
19ip, port = udp:getsockname() 19ip, port = udp:getsockname()
20assert(ip, port)
20print("Waiting packets on " .. ip .. ":" .. port .. "...") 21print("Waiting packets on " .. ip .. ":" .. port .. "...")
21while 1 do 22while 1 do
22 dgram, ip, port = udp:receivefrom() 23 dgram, ip, port = udp:receivefrom()