aboutsummaryrefslogtreecommitdiff
path: root/doc/introduction.html
diff options
context:
space:
mode:
Diffstat (limited to 'doc/introduction.html')
-rw-r--r--doc/introduction.html10
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
183local socket = require("socket") 183local 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
185local server = socket.try(socket.bind("*", 0)) 185local 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
187local ip, port = server:getsockname() 187local 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
288local socket = require("socket") 288local socket = require("socket")
289-- convert host name to ip address 289-- convert host name to ip address
290local ip = socket.try(socket.dns.toip(host)) 290local ip = assert(socket.dns.toip(host))
291-- create a new UDP object 291-- create a new UDP object
292local udp = socket.try(socket.udp()) 292local udp = assert(socket.udp())
293-- contact daytime host 293-- contact daytime host
294socket.try(udp:sendto("anything", ip, port)) 294assert(udp:sendto("anything", ip, port))
295-- retrieve the answer and print results 295-- retrieve the answer and print results
296io.write(socket.try((udp:receive()))) 296io.write(assert(udp:receive()))
297</pre> 297</pre>
298</blockquote> 298</blockquote>
299 299