mirror of
https://github.com/lunarmodules/luasocket.git
synced 2025-07-13 06:04:31 +02:00
Adjusted a few inconsistencies with the manual.
This commit is contained in:
@ -10,17 +10,17 @@ if arg then
|
||||
host = arg[1] or host
|
||||
port = arg[2] or port
|
||||
end
|
||||
host = socket.toip(host)
|
||||
host = socket.dns.toip(host)
|
||||
udp, err = socket.udp()
|
||||
if not udp then print(err) exit() end
|
||||
err = udp:setpeername(host, port)
|
||||
if err then print(err) exit() end
|
||||
assert(udp, err)
|
||||
ret, err = udp:setpeername(host, port)
|
||||
assert(ret, err)
|
||||
print("Using host '" ..host.. "' and port " .. port .. "...")
|
||||
while 1 do
|
||||
line = io.read()
|
||||
if not line then os.exit() end
|
||||
err = udp:send(line)
|
||||
if err then print(err) os.exit() end
|
||||
ret, err = udp:send(line)
|
||||
if not ret then print(err) os.exit() end
|
||||
dgram, err = udp:receive()
|
||||
if not dgram then print(err) os.exit() end
|
||||
print(dgram)
|
||||
|
Reference in New Issue
Block a user