From 8d4e240f6ae50d9b22ddc44f5e207018935da907 Mon Sep 17 00:00:00 2001 From: Diego Nehab <diego@tecgraf.puc-rio.br> Date: Tue, 8 Feb 2005 10:01:01 +0000 Subject: Forward server working on Mac OS X... --- doc/ftp.html | 12 ++++++------ doc/http.html | 8 ++++---- doc/introduction.html | 10 +++++----- doc/ltn12.html | 2 +- doc/smtp.html | 6 +++--- doc/socket.html | 9 +++++++-- doc/url.html | 6 +++--- 7 files changed, 29 insertions(+), 24 deletions(-) (limited to 'doc') 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: <pre class=example> -- loads the FTP module and any libraries it requires -local ftp = require("ftp") +local ftp = require("socket.ftp") </pre> <p> @@ -150,7 +150,7 @@ error. <pre class=example> -- load the ftp support -local ftp = require("ftp") +local ftp = require("socket.ftp") -- Log as user "anonymous" on server "ftp.tecgraf.puc-rio.br", -- 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") <pre class=example> -- load needed modules -local ftp = require("ftp") +local ftp = require("socket.ftp") local ltn12 = require("ltn12") -local url = require("url") +local url = require("socket.url") -- a function that returns a directory listing function nlst(u) @@ -230,7 +230,7 @@ message describing the reason for failure. <pre class=example> -- load the ftp support -local ftp = require("ftp") +local ftp = require("socket.ftp") -- Log as user "fulano" on server "ftp.example.com", -- 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", <pre class=example> -- load the ftp support -local ftp = require("ftp") +local ftp = require("socket.ftp") local ltn12 = require("ltn12") -- 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: <pre class=example> -- loads the HTTP module and any libraries it requires -local http = require("http") +local http = require("socket.http") </pre> <p> @@ -206,7 +206,7 @@ Here are a few examples with the simple interface: <pre class=example> -- load the http module -http = require("http") +http = require("socket.http") -- connect to server "www.tecgraf.puc-rio.br" and retrieves this manual -- file from "/luasocket/http.html" @@ -231,7 +231,7 @@ And here is an example using the generic interface: <pre class=example> -- load the http module -http = require("http") +http = require("socket.http") -- Requests information about a document, without downloading it. -- Useful, for example, if you want to display a download gauge and need @@ -276,7 +276,7 @@ authentication is required. <pre class=example> -- load required modules -http = require("http") +http = require("socket.http") mime = require("mime") -- 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. -- load namespace local socket = require("socket") -- create a TCP socket and bind it to the local host, at any port -local server = socket.try(socket.bind("*", 0)) +local server = assert(socket.bind("*", 0)) -- find out which port the OS chose for us local ip, port = server:getsockname() -- print a message informing what's up @@ -287,13 +287,13 @@ local host, port = "localhost", 13 -- load namespace local socket = require("socket") -- convert host name to ip address -local ip = socket.try(socket.dns.toip(host)) +local ip = assert(socket.dns.toip(host)) -- create a new UDP object -local udp = socket.try(socket.udp()) +local udp = assert(socket.udp()) -- contact daytime host -socket.try(udp:sendto("anything", ip, port)) +assert(udp:sendto("anything", ip, port)) -- retrieve the answer and print results -io.write(socket.try((udp:receive()))) +io.write(assert(udp:receive())) </pre> </blockquote> 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. <pre class=example> -- load needed modules -local http = require("http") +local http = require("socket.http") local ltn12 = require("ltn12") -- 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: <pre class=example> -- loads the SMTP module and everything it requires -local smtp = require("smtp") +local smtp = require("socket.smtp") </pre> <p> @@ -239,7 +239,7 @@ and <pre class=example> -- load the smtp support -local smtp = require("smtp") +local smtp = require("socket.smtp") -- Connects to server "localhost" and sends a message to users -- "fulano@example.com", "beltrano@example.com", @@ -329,7 +329,7 @@ as listed in the introduction. </p> <pre class=example> -- load the smtp support and its friends -local smtp = require("smtp") +local smtp = require("socket.smtp") local mime = require("mime") local ltn12 = require("ltn12") 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> </p> <p class=description> -Converts a function that throws exceptions into a safe function. +Converts a function that throws exceptions into a safe function. This +function only catches exceptions thrown by the <a href=#try><tt>try</tt></a> +and <a href=#newtry><tt>newtry</tt></a> functions. It does not catch normal +Lua errors. </p> <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 </p> <p class=description> -Throws an exception in case of error. +Throws an exception in case of error. The exception can only be caught +by the <a href=#protect><tt>protect</tt></a> function. It does not explode +into an error message. </p> <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: <pre class=example> -- loads the URL module -local url = require("url") +local url = require("socket.url") </pre> <p> @@ -193,7 +193,7 @@ The function returns the encoded string. <pre class=example> -- load url module -url = require("url") +url = require("socket.url") code = url.escape("/#?;") -- code = "%2f%23%3f%3b" @@ -239,7 +239,7 @@ parsed_url = {<br> <pre class=example> -- load url module -url = require("url") +url = require("socket.url") parsed_url = url.parse("http://www.example.com/cgilua/index.lua?a=2#there") -- parsed_url = { -- cgit v1.2.3-55-g6feb