diff options
| author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2003-03-28 21:08:50 +0000 |
|---|---|---|
| committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2003-03-28 21:08:50 +0000 |
| commit | f18d1b7cd0ec4708518ab5e18ea33b6eadca0301 (patch) | |
| tree | e831c6b1957af47db1301675b52c0d2a2e315fa7 /samples/echoclnt.lua | |
| parent | 307603b24dde69eac62d2cb52123488137520c9c (diff) | |
| download | luasocket-f18d1b7cd0ec4708518ab5e18ea33b6eadca0301.tar.gz luasocket-f18d1b7cd0ec4708518ab5e18ea33b6eadca0301.tar.bz2 luasocket-f18d1b7cd0ec4708518ab5e18ea33b6eadca0301.zip | |
Closer to release...
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 043b2f0..cd8b450 100644 --- a/samples/echoclnt.lua +++ b/samples/echoclnt.lua | |||
| @@ -4,18 +4,18 @@ if arg then | |||
| 4 | host = arg[1] or host | 4 | host = arg[1] or host |
| 5 | port = arg[2] or port | 5 | port = arg[2] or port |
| 6 | end | 6 | end |
| 7 | host = toip(host) | 7 | host = socket.toip(host) |
| 8 | udp, err = udpsocket() | 8 | udp, err = socket.udp() |
| 9 | if not udp then print(err) exit() end | 9 | if not udp then print(err) exit() end |
| 10 | err = udp:setpeername(host, port) | 10 | err = udp:setpeername(host, port) |
| 11 | if err then print(err) exit() end | 11 | if err then print(err) exit() end |
| 12 | print("Using host '" ..host.. "' and port " .. port .. "...") | 12 | print("Using host '" ..host.. "' and port " .. port .. "...") |
| 13 | while 1 do | 13 | while 1 do |
| 14 | line = read() | 14 | line = io.read() |
| 15 | if not line then exit() end | 15 | if not line then os.exit() end |
| 16 | err = udp:send(line) | 16 | err = udp:send(line) |
| 17 | if err then print(err) exit() end | 17 | if err then print(err) os.exit() end |
| 18 | dgram, err = udp:receive() | 18 | dgram, err = udp:receive() |
| 19 | if not dgram then print(err) exit() end | 19 | if not dgram then print(err) os.exit() end |
| 20 | print(dgram) | 20 | print(dgram) |
| 21 | end | 21 | end |
