diff options
| author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2003-08-16 00:06:04 +0000 |
|---|---|---|
| committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2003-08-16 00:06:04 +0000 |
| commit | c51d4acf1c2a8675a3bb043e799ff4390cef47d6 (patch) | |
| tree | 345b71aa70b50c964a58980461e147a260fa6e0b /samples/echosrvr.lua | |
| parent | 3099704affa1fda195eb8f3934f6c1f18bf1f706 (diff) | |
| download | luasocket-c51d4acf1c2a8675a3bb043e799ff4390cef47d6.tar.gz luasocket-c51d4acf1c2a8675a3bb043e799ff4390cef47d6.tar.bz2 luasocket-c51d4acf1c2a8675a3bb043e799ff4390cef47d6.zip | |
Adjusted a few inconsistencies with the manual.
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() |
