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 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
6end 6end
7host = toip(host) 7host = socket.toip(host)
8udp, err = udpsocket() 8udp, err = socket.udp()
9if not udp then print(err) exit() end 9if not udp then print(err) exit() end
10err = udp:setpeername(host, port) 10err = udp:setpeername(host, port)
11if err then print(err) exit() end 11if err then print(err) exit() end
12print("Using host '" ..host.. "' and port " .. port .. "...") 12print("Using host '" ..host.. "' and port " .. port .. "...")
13while 1 do 13while 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)
21end 21end