aboutsummaryrefslogtreecommitdiff
path: root/samples/echosrvr.lua
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2005-01-02 22:44:00 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2005-01-02 22:44:00 +0000
commit97b26e0b66c840a446a0179200c7df23565330d1 (patch)
tree272f9ea0451f13b563451fb8df21a03669e90d09 /samples/echosrvr.lua
parenta8254e94f8c14ac15b02be53a1cc69ba80899230 (diff)
downloadluasocket-97b26e0b66c840a446a0179200c7df23565330d1.tar.gz
luasocket-97b26e0b66c840a446a0179200c7df23565330d1.tar.bz2
luasocket-97b26e0b66c840a446a0179200c7df23565330d1.zip
Almost ready to release beta3
Diffstat (limited to 'samples/echosrvr.lua')
-rw-r--r--samples/echosrvr.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/samples/echosrvr.lua b/samples/echosrvr.lua
index 3ebbe85..d4449e5 100644
--- a/samples/echosrvr.lua
+++ b/samples/echosrvr.lua
@@ -12,10 +12,11 @@ if arg then
12 port = arg[2] or port 12 port = arg[2] or port
13end 13end
14print("Binding to host '" ..host.. "' and port " ..port.. "...") 14print("Binding to host '" ..host.. "' and port " ..port.. "...")
15udp = socket.try(socket.udp()) 15udp = assert(socket.udp())
16socket.try(udp:setsockname(host, port)) 16assert(udp:setsockname(host, port))
17socket.try(udp:settimeout(5)) 17assert(udp:settimeout(5))
18ip, port = socket.try(udp:getsockname()) 18ip, port = udp:getsockname()
19assert(ip, port)
19print("Waiting packets on " .. ip .. ":" .. port .. "...") 20print("Waiting packets on " .. ip .. ":" .. port .. "...")
20while 1 do 21while 1 do
21 dgram, ip, port = udp:receivefrom() 22 dgram, ip, port = udp:receivefrom()