diff options
Diffstat (limited to 'samples/daytimeclnt.lua')
-rw-r--r-- | samples/daytimeclnt.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/samples/daytimeclnt.lua b/samples/daytimeclnt.lua new file mode 100644 index 0000000..94e03d3 --- /dev/null +++ b/samples/daytimeclnt.lua | |||
@@ -0,0 +1,14 @@ | |||
1 | host = host or "127.0.0.1" | ||
2 | port = port or 13 | ||
3 | if arg then | ||
4 | host = arg[1] or host | ||
5 | port = arg[2] or port | ||
6 | end | ||
7 | host = toip(host) | ||
8 | udp = udpsocket() | ||
9 | print("Using host '" ..host.. "' and port " ..port.. "...") | ||
10 | err = sendto(udp, "anything", host, port) | ||
11 | if err then print(err) exit() end | ||
12 | dgram, err = receive(udp) | ||
13 | if not dgram then print(err) exit() end | ||
14 | write(dgram) | ||