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/echoclnt.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/echoclnt.lua')
| -rw-r--r-- | samples/echoclnt.lua | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/samples/echoclnt.lua b/samples/echoclnt.lua index e028b86..56bd123 100644 --- a/samples/echoclnt.lua +++ b/samples/echoclnt.lua | |||
| @@ -10,17 +10,17 @@ if arg then | |||
| 10 | host = arg[1] or host | 10 | host = arg[1] or host |
| 11 | port = arg[2] or port | 11 | port = arg[2] or port |
| 12 | end | 12 | end |
| 13 | host = socket.toip(host) | 13 | host = socket.dns.toip(host) |
| 14 | udp, err = socket.udp() | 14 | udp, err = socket.udp() |
| 15 | if not udp then print(err) exit() end | 15 | assert(udp, err) |
| 16 | err = udp:setpeername(host, port) | 16 | ret, err = udp:setpeername(host, port) |
| 17 | if err then print(err) exit() end | 17 | assert(ret, err) |
| 18 | print("Using host '" ..host.. "' and port " .. port .. "...") | 18 | print("Using host '" ..host.. "' and port " .. port .. "...") |
| 19 | while 1 do | 19 | while 1 do |
| 20 | line = io.read() | 20 | line = io.read() |
| 21 | if not line then os.exit() end | 21 | if not line then os.exit() end |
| 22 | err = udp:send(line) | 22 | ret, err = udp:send(line) |
| 23 | if err then print(err) os.exit() end | 23 | if not ret then print(err) os.exit() end |
| 24 | dgram, err = udp:receive() | 24 | dgram, err = udp:receive() |
| 25 | if not dgram then print(err) os.exit() end | 25 | if not dgram then print(err) os.exit() end |
| 26 | print(dgram) | 26 | print(dgram) |
