aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2005-02-08 10:01:01 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2005-02-08 10:01:01 +0000
commit8d4e240f6ae50d9b22ddc44f5e207018935da907 (patch)
treed8ca9a51dc35534592f700e42740feac20242ede /doc
parent5d32848674b723521e87836eafa24f5ae8f80a89 (diff)
downloadluasocket-8d4e240f6ae50d9b22ddc44f5e207018935da907.tar.gz
luasocket-8d4e240f6ae50d9b22ddc44f5e207018935da907.tar.bz2
luasocket-8d4e240f6ae50d9b22ddc44f5e207018935da907.zip
Forward server working on Mac OS X...
Diffstat (limited to 'doc')
-rw-r--r--doc/ftp.html12
-rw-r--r--doc/http.html8
-rw-r--r--doc/introduction.html10
-rw-r--r--doc/ltn12.html2
-rw-r--r--doc/smtp.html6
-rw-r--r--doc/socket.html9
-rw-r--r--doc/url.html6
7 files changed, 29 insertions, 24 deletions
diff --git a/doc/ftp.html b/doc/ftp.html
index 454d417..7860c27 100644
--- a/doc/ftp.html
+++ b/doc/ftp.html
@@ -65,7 +65,7 @@ To obtain the <tt>ftp</tt> namespace, run:
65 65
66<pre class=example> 66<pre class=example>
67-- loads the FTP module and any libraries it requires 67-- loads the FTP module and any libraries it requires
68local ftp = require("ftp") 68local ftp = require("socket.ftp")
69</pre> 69</pre>
70 70
71<p> 71<p>
@@ -150,7 +150,7 @@ error.
150 150
151<pre class=example> 151<pre class=example>
152-- load the ftp support 152-- load the ftp support
153local ftp = require("ftp") 153local ftp = require("socket.ftp")
154 154
155-- Log as user "anonymous" on server "ftp.tecgraf.puc-rio.br", 155-- Log as user "anonymous" on server "ftp.tecgraf.puc-rio.br",
156-- and get file "lua.tar.gz" from directory "pub/lua" as binary. 156-- and get file "lua.tar.gz" from directory "pub/lua" as binary.
@@ -159,9 +159,9 @@ f, e = ftp.get("ftp://ftp.tecgraf.puc-rio.br/pub/lua/lua.tar.gz;type=i")
159 159
160<pre class=example> 160<pre class=example>
161-- load needed modules 161-- load needed modules
162local ftp = require("ftp") 162local ftp = require("socket.ftp")
163local ltn12 = require("ltn12") 163local ltn12 = require("ltn12")
164local url = require("url") 164local url = require("socket.url")
165 165
166-- a function that returns a directory listing 166-- a function that returns a directory listing
167function nlst(u) 167function nlst(u)
@@ -230,7 +230,7 @@ message describing the reason for failure.
230 230
231<pre class=example> 231<pre class=example>
232-- load the ftp support 232-- load the ftp support
233local ftp = require("ftp") 233local ftp = require("socket.ftp")
234 234
235-- Log as user "fulano" on server "ftp.example.com", 235-- Log as user "fulano" on server "ftp.example.com",
236-- using password "silva", and store a file "README" with contents 236-- using password "silva", and store a file "README" with contents
@@ -241,7 +241,7 @@ f, e = ftp.put("ftp://fulano:silva@ftp.example.com/README",
241 241
242<pre class=example> 242<pre class=example>
243-- load the ftp support 243-- load the ftp support
244local ftp = require("ftp") 244local ftp = require("socket.ftp")
245local ltn12 = require("ltn12") 245local ltn12 = require("ltn12")
246 246
247-- Log as user "fulano" on server "ftp.example.com", 247-- Log as user "fulano" on server "ftp.example.com",
diff --git a/doc/http.html b/doc/http.html
index 4cbbe95..af58571 100644
--- a/doc/http.html
+++ b/doc/http.html
@@ -62,7 +62,7 @@ To obtain the <tt>http</tt> namespace, run:
62 62
63<pre class=example> 63<pre class=example>
64-- loads the HTTP module and any libraries it requires 64-- loads the HTTP module and any libraries it requires
65local http = require("http") 65local http = require("socket.http")
66</pre> 66</pre>
67 67
68<p> 68<p>
@@ -206,7 +206,7 @@ Here are a few examples with the simple interface:
206 206
207<pre class=example> 207<pre class=example>
208-- load the http module 208-- load the http module
209http = require("http") 209http = require("socket.http")
210 210
211-- connect to server "www.tecgraf.puc-rio.br" and retrieves this manual 211-- connect to server "www.tecgraf.puc-rio.br" and retrieves this manual
212-- file from "/luasocket/http.html" 212-- file from "/luasocket/http.html"
@@ -231,7 +231,7 @@ And here is an example using the generic interface:
231 231
232<pre class=example> 232<pre class=example>
233-- load the http module 233-- load the http module
234http = require("http") 234http = require("socket.http")
235 235
236-- Requests information about a document, without downloading it. 236-- Requests information about a document, without downloading it.
237-- Useful, for example, if you want to display a download gauge and need 237-- Useful, for example, if you want to display a download gauge and need
@@ -276,7 +276,7 @@ authentication is required.
276 276
277<pre class=example> 277<pre class=example>
278-- load required modules 278-- load required modules
279http = require("http") 279http = require("socket.http")
280mime = require("mime") 280mime = require("mime")
281 281
282-- Connect to server "www.example.com" and tries to retrieve 282-- Connect to server "www.example.com" and tries to retrieve
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
diff --git a/doc/ltn12.html b/doc/ltn12.html
index 44fcbe4..c5a0f59 100644
--- a/doc/ltn12.html
+++ b/doc/ltn12.html
@@ -271,7 +271,7 @@ The function returns the sink and the table used to store the chunks.
271 271
272<pre class=example> 272<pre class=example>
273-- load needed modules 273-- load needed modules
274local http = require("http") 274local http = require("socket.http")
275local ltn12 = require("ltn12") 275local ltn12 = require("ltn12")
276 276
277-- a simplified http.get function 277-- a simplified http.get function
diff --git a/doc/smtp.html b/doc/smtp.html
index 8feae3e..bd18bfa 100644
--- a/doc/smtp.html
+++ b/doc/smtp.html
@@ -69,7 +69,7 @@ To obtain the <tt>smtp</tt> namespace, run:
69 69
70<pre class=example> 70<pre class=example>
71-- loads the SMTP module and everything it requires 71-- loads the SMTP module and everything it requires
72local smtp = require("smtp") 72local smtp = require("socket.smtp")
73</pre> 73</pre>
74 74
75<p> 75<p>
@@ -239,7 +239,7 @@ and
239 239
240<pre class=example> 240<pre class=example>
241-- load the smtp support 241-- load the smtp support
242local smtp = require("smtp") 242local smtp = require("socket.smtp")
243 243
244-- Connects to server "localhost" and sends a message to users 244-- Connects to server "localhost" and sends a message to users
245-- "fulano@example.com", "beltrano@example.com", 245-- "fulano@example.com", "beltrano@example.com",
@@ -329,7 +329,7 @@ as listed in the introduction. </p>
329 329
330<pre class=example> 330<pre class=example>
331-- load the smtp support and its friends 331-- load the smtp support and its friends
332local smtp = require("smtp") 332local smtp = require("socket.smtp")
333local mime = require("mime") 333local mime = require("mime")
334local ltn12 = require("ltn12") 334local ltn12 = require("ltn12")
335 335
diff --git a/doc/socket.html b/doc/socket.html
index f638fd9..18c71d1 100644
--- a/doc/socket.html
+++ b/doc/socket.html
@@ -145,7 +145,10 @@ socket.<b>protect(</b>func<b>)</b>
145</p> 145</p>
146 146
147<p class=description> 147<p class=description>
148Converts a function that throws exceptions into a safe function. 148Converts a function that throws exceptions into a safe function. This
149function only catches exceptions thrown by the <a href=#try><tt>try</tt></a>
150and <a href=#newtry><tt>newtry</tt></a> functions. It does not catch normal
151Lua errors.
149</p> 152</p>
150 153
151<p class=parameters> 154<p class=parameters>
@@ -346,7 +349,9 @@ socket.<b>try(</b>ret<sub>1</sub> [, ret<sub>2</sub> ... ret<sub>N</sub>]<b>)</b
346</p> 349</p>
347 350
348<p class=description> 351<p class=description>
349Throws an exception in case of error. 352Throws an exception in case of error. The exception can only be caught
353by the <a href=#protect><tt>protect</tt></a> function. It does not explode
354into an error message.
350</p> 355</p>
351 356
352<p class=parameters> 357<p class=parameters>
diff --git a/doc/url.html b/doc/url.html
index 56e1ef5..ac84d24 100644
--- a/doc/url.html
+++ b/doc/url.html
@@ -52,7 +52,7 @@ To obtain the <tt>url</tt> namespace, run:
52 52
53<pre class=example> 53<pre class=example>
54-- loads the URL module 54-- loads the URL module
55local url = require("url") 55local url = require("socket.url")
56</pre> 56</pre>
57 57
58<p> 58<p>
@@ -193,7 +193,7 @@ The function returns the encoded string.
193 193
194<pre class=example> 194<pre class=example>
195-- load url module 195-- load url module
196url = require("url") 196url = require("socket.url")
197 197
198code = url.escape("/#?;") 198code = url.escape("/#?;")
199-- code = "%2f%23%3f%3b" 199-- code = "%2f%23%3f%3b"
@@ -239,7 +239,7 @@ parsed_url = {<br>
239 239
240<pre class=example> 240<pre class=example>
241-- load url module 241-- load url module
242url = require("url") 242url = require("socket.url")
243 243
244parsed_url = url.parse("http://www.example.com/cgilua/index.lua?a=2#there") 244parsed_url = url.parse("http://www.example.com/cgilua/index.lua?a=2#there")
245-- parsed_url = { 245-- parsed_url = {