diff options
Diffstat (limited to 'samples/echosrvr.lua')
| -rw-r--r-- | samples/echosrvr.lua | 9 |
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 | |||
| 12 | end | 12 | end |
| 13 | print("Binding to host '" ..host.. "' and port " ..port.. "...") | 13 | print("Binding to host '" ..host.. "' and port " ..port.. "...") |
| 14 | udp, err = socket.udp() | 14 | udp, err = socket.udp() |
| 15 | if not udp then print(err) os.exit() end | 15 | assert(udp, err) |
| 16 | err = udp:setsockname(host, port) | 16 | ret, err = udp:setsockname(host, port) |
| 17 | if err then print(err) os.exit() end | 17 | assert(ret, err) |
| 18 | udp:timeout(5) | 18 | udp:settimeout(5) |
| 19 | ip, port = udp:getsockname() | 19 | ip, port = udp:getsockname() |
| 20 | assert(ip, port) | ||
| 20 | print("Waiting packets on " .. ip .. ":" .. port .. "...") | 21 | print("Waiting packets on " .. ip .. ":" .. port .. "...") |
| 21 | while 1 do | 22 | while 1 do |
| 22 | dgram, ip, port = udp:receivefrom() | 23 | dgram, ip, port = udp:receivefrom() |
