1
-----------------------------------------------------------------------------
2
-- UDP sample: daytime protocol client
3
-- LuaSocket sample files
5
-- RCS ID: $Id: daytimeclnt.lua,v 1.11 2004/06/21 06:07:57 diego Exp $
6
-----------------------------------------------------------------------------
7
local socket = require"socket"
8
host = host or "127.0.0.1"
14
host = socket.dns.toip(host)
16
print("Using host '" ..host.. "' and port " ..port.. "...")
17
udp:setpeername(host, port)
19
sent, err = udp:send("anything")
20
if err then print(err) os.exit() end
21
dgram, err = udp:receive()
22
if not dgram then print(err) os.exit() end