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 | |
| 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')
| -rw-r--r-- | doc/ftp.html | 12 | ||||
| -rw-r--r-- | doc/http.html | 8 | ||||
| -rw-r--r-- | doc/introduction.html | 10 | ||||
| -rw-r--r-- | doc/ltn12.html | 2 | ||||
| -rw-r--r-- | doc/smtp.html | 6 | ||||
| -rw-r--r-- | doc/socket.html | 9 | ||||
| -rw-r--r-- | doc/url.html | 6 |
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 |
| 68 | local ftp = require("ftp") | 68 | local 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 |
| 153 | local ftp = require("ftp") | 153 | local 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 |
| 162 | local ftp = require("ftp") | 162 | local ftp = require("socket.ftp") |
| 163 | local ltn12 = require("ltn12") | 163 | local ltn12 = require("ltn12") |
| 164 | local url = require("url") | 164 | local url = require("socket.url") |
| 165 | 165 | ||
| 166 | -- a function that returns a directory listing | 166 | -- a function that returns a directory listing |
| 167 | function nlst(u) | 167 | function 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 |
| 233 | local ftp = require("ftp") | 233 | local 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 |
| 244 | local ftp = require("ftp") | 244 | local ftp = require("socket.ftp") |
| 245 | local ltn12 = require("ltn12") | 245 | local 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 |
| 65 | local http = require("http") | 65 | local 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 |
| 209 | http = require("http") | 209 | http = 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 |
| 234 | http = require("http") | 234 | http = 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 |
| 279 | http = require("http") | 279 | http = require("socket.http") |
| 280 | mime = require("mime") | 280 | mime = 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 |
| 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 | ||
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 |
| 274 | local http = require("http") | 274 | local http = require("socket.http") |
| 275 | local ltn12 = require("ltn12") | 275 | local 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 |
| 72 | local smtp = require("smtp") | 72 | local 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 |
| 242 | local smtp = require("smtp") | 242 | local 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 |
| 332 | local smtp = require("smtp") | 332 | local smtp = require("socket.smtp") |
| 333 | local mime = require("mime") | 333 | local mime = require("mime") |
| 334 | local ltn12 = require("ltn12") | 334 | local 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> |
| 148 | Converts a function that throws exceptions into a safe function. | 148 | Converts a function that throws exceptions into a safe function. This |
| 149 | function only catches exceptions thrown by the <a href=#try><tt>try</tt></a> | ||
| 150 | and <a href=#newtry><tt>newtry</tt></a> functions. It does not catch normal | ||
| 151 | Lua 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> |
| 349 | Throws an exception in case of error. | 352 | Throws an exception in case of error. The exception can only be caught |
| 353 | by the <a href=#protect><tt>protect</tt></a> function. It does not explode | ||
| 354 | into 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 |
| 55 | local url = require("url") | 55 | local 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 |
| 196 | url = require("url") | 196 | url = require("socket.url") |
| 197 | 197 | ||
| 198 | code = url.escape("/#?;") | 198 | code = 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 |
| 242 | url = require("url") | 242 | url = require("socket.url") |
| 243 | 243 | ||
| 244 | parsed_url = url.parse("http://www.example.com/cgilua/index.lua?a=2#there") | 244 | parsed_url = url.parse("http://www.example.com/cgilua/index.lua?a=2#there") |
| 245 | -- parsed_url = { | 245 | -- parsed_url = { |
