aboutsummaryrefslogtreecommitdiff
path: root/samples/echoclnt.lua
diff options
context:
space:
mode:
Diffstat (limited to 'samples/echoclnt.lua')
-rw-r--r--samples/echoclnt.lua12
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
12end 12end
13host = socket.toip(host) 13host = socket.dns.toip(host)
14udp, err = socket.udp() 14udp, err = socket.udp()
15if not udp then print(err) exit() end 15assert(udp, err)
16err = udp:setpeername(host, port) 16ret, err = udp:setpeername(host, port)
17if err then print(err) exit() end 17assert(ret, err)
18print("Using host '" ..host.. "' and port " .. port .. "...") 18print("Using host '" ..host.. "' and port " .. port .. "...")
19while 1 do 19while 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)