1
-----------------------------------------------------------------------------
2
-- UDP sample: echo protocol client
3
-- LuaSocket sample files
5
-- RCS ID: $Id: echoclnt.lua,v 1.10 2005/01/02 22:44:00 diego Exp $
6
-----------------------------------------------------------------------------
7
local socket = require("socket")
8
host = host or "localhost"
14
host = socket.dns.toip(host)
15
udp = assert(socket.udp())
16
assert(udp:setpeername(host, port))
17
print("Using remote host '" ..host.. "' and port " .. port .. "...")
20
if not line or line == "" then os.exit() end
21
assert(udp:send(line))
22
dgram = assert(udp:receive())