diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2005-02-08 10:01:01 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2005-02-08 10:01:01 +0000 |
commit | 8d4e240f6ae50d9b22ddc44f5e207018935da907 (patch) | |
tree | d8ca9a51dc35534592f700e42740feac20242ede /doc/introduction.html | |
parent | 5d32848674b723521e87836eafa24f5ae8f80a89 (diff) | |
download | luasocket-8d4e240f6ae50d9b22ddc44f5e207018935da907.tar.gz luasocket-8d4e240f6ae50d9b22ddc44f5e207018935da907.tar.bz2 luasocket-8d4e240f6ae50d9b22ddc44f5e207018935da907.zip |
Forward server working on Mac OS X...
Diffstat (limited to 'doc/introduction.html')
-rw-r--r-- | doc/introduction.html | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/doc/introduction.html b/doc/introduction.html index f8fe078..c88fa40 100644 --- a/doc/introduction.html +++ b/doc/introduction.html | |||
@@ -182,7 +182,7 @@ program. | |||
182 | -- load namespace | 182 | -- load namespace |
183 | local socket = require("socket") | 183 | local socket = require("socket") |
184 | -- create a TCP socket and bind it to the local host, at any port | 184 | -- create a TCP socket and bind it to the local host, at any port |
185 | local server = socket.try(socket.bind("*", 0)) | 185 | local server = assert(socket.bind("*", 0)) |
186 | -- find out which port the OS chose for us | 186 | -- find out which port the OS chose for us |
187 | local ip, port = server:getsockname() | 187 | local ip, port = server:getsockname() |
188 | -- print a message informing what's up | 188 | -- print a message informing what's up |
@@ -287,13 +287,13 @@ local host, port = "localhost", 13 | |||
287 | -- load namespace | 287 | -- load namespace |
288 | local socket = require("socket") | 288 | local socket = require("socket") |
289 | -- convert host name to ip address | 289 | -- convert host name to ip address |
290 | local ip = socket.try(socket.dns.toip(host)) | 290 | local ip = assert(socket.dns.toip(host)) |
291 | -- create a new UDP object | 291 | -- create a new UDP object |
292 | local udp = socket.try(socket.udp()) | 292 | local udp = assert(socket.udp()) |
293 | -- contact daytime host | 293 | -- contact daytime host |
294 | socket.try(udp:sendto("anything", ip, port)) | 294 | assert(udp:sendto("anything", ip, port)) |
295 | -- retrieve the answer and print results | 295 | -- retrieve the answer and print results |
296 | io.write(socket.try((udp:receive()))) | 296 | io.write(assert(udp:receive())) |
297 | </pre> | 297 | </pre> |
298 | </blockquote> | 298 | </blockquote> |
299 | 299 | ||