diff options
Diffstat (limited to 'samples/echosrvr.lua')
-rw-r--r-- | samples/echosrvr.lua | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/samples/echosrvr.lua b/samples/echosrvr.lua index fe7da06..330f9e6 100644 --- a/samples/echosrvr.lua +++ b/samples/echosrvr.lua | |||
@@ -7,16 +7,16 @@ end | |||
7 | print("Binding to host '" ..host.. "' and port " ..port.. "...") | 7 | print("Binding to host '" ..host.. "' and port " ..port.. "...") |
8 | udp, err = udpsocket() | 8 | udp, err = udpsocket() |
9 | if not udp then print(err) exit() end | 9 | if not udp then print(err) exit() end |
10 | err = setsockname(udp, host, port) | 10 | err = udp:setsockname(host, port) |
11 | if err then print(err) exit() end | 11 | if err then print(err) exit() end |
12 | timeout(udp, 5) | 12 | udp:timeout(5) |
13 | ip, port = getsockname(udp) | 13 | ip, port = udp:getsockname() |
14 | print("Waiting packets on " .. ip .. ":" .. port .. "...") | 14 | print("Waiting packets on " .. ip .. ":" .. port .. "...") |
15 | while 1 do | 15 | while 1 do |
16 | dgram, ip, port = receivefrom(udp) | 16 | dgram, ip, port = udp:receivefrom() |
17 | if not dgram then print(ip) | 17 | if not dgram then print(ip) |
18 | else | 18 | else |
19 | print("Echoing from " .. ip .. ":" .. port) | 19 | print("Echoing from " .. ip .. ":" .. port) |
20 | sendto(udp, dgram, ip, port) | 20 | udp:sendto(dgram, ip, port) |
21 | end | 21 | end |
22 | end | 22 | end |