diff options
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 | ||