diff options
| author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2005-01-02 22:44:00 +0000 |
|---|---|---|
| committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2005-01-02 22:44:00 +0000 |
| commit | 97b26e0b66c840a446a0179200c7df23565330d1 (patch) | |
| tree | 272f9ea0451f13b563451fb8df21a03669e90d09 /samples/echoclnt.lua | |
| parent | a8254e94f8c14ac15b02be53a1cc69ba80899230 (diff) | |
| download | luasocket-97b26e0b66c840a446a0179200c7df23565330d1.tar.gz luasocket-97b26e0b66c840a446a0179200c7df23565330d1.tar.bz2 luasocket-97b26e0b66c840a446a0179200c7df23565330d1.zip | |
Almost ready to release beta3
Diffstat (limited to 'samples/echoclnt.lua')
| -rw-r--r-- | samples/echoclnt.lua | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/samples/echoclnt.lua b/samples/echoclnt.lua index 038061d..764e433 100644 --- a/samples/echoclnt.lua +++ b/samples/echoclnt.lua | |||
| @@ -12,13 +12,13 @@ if arg then | |||
| 12 | port = arg[2] or port | 12 | port = arg[2] or port |
| 13 | end | 13 | end |
| 14 | host = socket.dns.toip(host) | 14 | host = socket.dns.toip(host) |
| 15 | udp = socket.try(socket.udp()) | 15 | udp = assert(socket.udp()) |
| 16 | socket.try(udp:setpeername(host, port)) | 16 | assert(udp:setpeername(host, port)) |
| 17 | print("Using remote host '" ..host.. "' and port " .. port .. "...") | 17 | print("Using remote host '" ..host.. "' and port " .. port .. "...") |
| 18 | while 1 do | 18 | while 1 do |
| 19 | line = io.read() | 19 | line = io.read() |
| 20 | if not line then os.exit() end | 20 | if not line or line == "" then os.exit() end |
| 21 | socket.try(udp:send(line)) | 21 | assert(udp:send(line)) |
| 22 | dgram = socket.try(udp:receive()) | 22 | dgram = assert(udp:receive()) |
| 23 | print(dgram) | 23 | print(dgram) |
| 24 | end | 24 | end |
