mirror of
https://github.com/lunarmodules/luasocket.git
synced 2024-12-25 20:18:21 +01:00
style(docs): Trim trailing whitespace in HTML docs
Many editors remove these automatically anyway which makes opening and editng the docs cause a bunch of noise. This is just to get the noise out of the way in a style commit so it doesn't leak into other PRs
This commit is contained in:
parent
de359ea408
commit
453a5207ed
@ -1,11 +1,11 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="description" content="LuaSocket: Introduction to the core">
|
||||
<meta name="keywords" content="Lua, LuaSocket, TCP, UDP, Network, Support,
|
||||
Installation">
|
||||
Installation">
|
||||
<title>LuaSocket: Installation</title>
|
||||
<link rel="stylesheet" href="reference.css" type="text/css">
|
||||
</head>
|
||||
@ -29,7 +29,7 @@ Installation">
|
||||
<a href="index.html#download">download</a> ·
|
||||
<a href="installation.html">installation</a> ·
|
||||
<a href="introduction.html">introduction</a> ·
|
||||
<a href="reference.html">reference</a>
|
||||
<a href="reference.html">reference</a>
|
||||
</p>
|
||||
</center>
|
||||
<hr>
|
||||
@ -48,8 +48,8 @@ will likely already have been answered. </p>
|
||||
|
||||
<p> On Unix systems, the standard distribution uses two base
|
||||
directories, one for system dependent files, and another for system
|
||||
independent files. Let's call these directories <tt><CDIR></tt>
|
||||
and <tt><LDIR></tt>, respectively.
|
||||
independent files. Let's call these directories <tt><CDIR></tt>
|
||||
and <tt><LDIR></tt>, respectively.
|
||||
For example, in my laptp, Lua 5.1 is configured to
|
||||
use '<tt>/usr/local/lib/lua/5.1</tt>' for
|
||||
<tt><CDIR></tt> and '<tt>/usr/local/share/lua/5.1</tt>' for
|
||||
@ -57,9 +57,9 @@ use '<tt>/usr/local/lib/lua/5.1</tt>' for
|
||||
usually points to the directory where the Lua executable is
|
||||
found, and <tt><LDIR></tt> points to a
|
||||
<tt>lua/</tt> directory inside <tt><CDIR></tt>. (These
|
||||
settings can be overridden by environment variables
|
||||
settings can be overridden by environment variables
|
||||
<tt>LUA_PATH</tt> and <tt>LUA_CPATH</tt>. See the Lua
|
||||
documentation for details.) Here is the standard LuaSocket
|
||||
documentation for details.) Here is the standard LuaSocket
|
||||
distribution directory structure:</p>
|
||||
|
||||
<pre class=example>
|
||||
@ -76,7 +76,7 @@ distribution directory structure:</p>
|
||||
</pre>
|
||||
|
||||
<p> Naturally, on Unix systems, <tt>core.dll</tt>
|
||||
would be replaced by <tt>core.so</tt>.
|
||||
would be replaced by <tt>core.so</tt>.
|
||||
</p>
|
||||
|
||||
<h3>Using LuaSocket</h3>
|
||||
|
@ -1,11 +1,11 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="description" content="LuaSocket: Introduction to the core">
|
||||
<meta name="keywords" content="Lua, LuaSocket, TCP, UDP, Network,
|
||||
Library, Support">
|
||||
Library, Support">
|
||||
<title>LuaSocket: Introduction to the core</title>
|
||||
<link rel="stylesheet" href="reference.css" type="text/css">
|
||||
</head>
|
||||
@ -29,7 +29,7 @@ Library, Support">
|
||||
<a href="index.html#download">download</a> ·
|
||||
<a href="installation.html">installation</a> ·
|
||||
<a href="introduction.html">introduction</a> ·
|
||||
<a href="reference.html">reference</a>
|
||||
<a href="reference.html">reference</a>
|
||||
</p>
|
||||
</center>
|
||||
<hr>
|
||||
@ -61,23 +61,23 @@ interface to I/O across different domains and operating systems.
|
||||
The API design had two goals in mind. First, users
|
||||
experienced with the C API to sockets should feel comfortable using LuaSocket.
|
||||
Second, the simplicity and the feel of the Lua language should be
|
||||
preserved. To achieve these goals, the LuaSocket API keeps the function names and semantics the C API whenever possible, but their usage in Lua has been greatly simplified.
|
||||
preserved. To achieve these goals, the LuaSocket API keeps the function names and semantics the C API whenever possible, but their usage in Lua has been greatly simplified.
|
||||
</p>
|
||||
|
||||
|
||||
<p>
|
||||
One of the simplifications is the receive pattern capability.
|
||||
Applications can read data from stream domains (such as TCP)
|
||||
Applications can read data from stream domains (such as TCP)
|
||||
line by line, block by block, or until the connection is closed.
|
||||
All I/O reads are buffered and the performance differences between
|
||||
different receive patterns are negligible.
|
||||
different receive patterns are negligible.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Another advantage is the flexible timeout control
|
||||
mechanism. As in C, all I/O operations are blocking by default. For
|
||||
example, the <a href=tcp.html#send><tt>send</tt></a>,
|
||||
<a href=tcp.html#receive><tt>receive</tt></a> and
|
||||
example, the <a href=tcp.html#send><tt>send</tt></a>,
|
||||
<a href=tcp.html#receive><tt>receive</tt></a> and
|
||||
<a href=tcp.html#accept><tt>accept</tt></a> methods
|
||||
of the TCP domain will block the caller application until
|
||||
the operation is completed (if ever!). However, with a call to the
|
||||
@ -87,7 +87,7 @@ the time it can be blocked by LuaSocket (the "<tt>total</tt>" timeout), on
|
||||
the time LuaSocket can internally be blocked by any OS call (the
|
||||
"<tt>block</tt>" timeout) or a combination of the two. Each LuaSocket
|
||||
call might perform several OS calls, so that the two timeout values are
|
||||
<em>not</em> equivalent.
|
||||
<em>not</em> equivalent.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
@ -95,10 +95,10 @@ Finally, the host name resolution is transparent, meaning that most
|
||||
functions and methods accept both IP addresses and host names. In case a
|
||||
host name is given, the library queries the system's resolver and
|
||||
tries the main IP address returned. Note that direct use of IP addresses
|
||||
is more efficient, of course. The
|
||||
<a href=dns.html#toip><tt>toip</tt></a>
|
||||
and <a href=dns.html#tohostname><tt>tohostname</tt></a>
|
||||
functions from the DNS module are provided to convert between host names and IP addresses.
|
||||
is more efficient, of course. The
|
||||
<a href=dns.html#toip><tt>toip</tt></a>
|
||||
and <a href=dns.html#tohostname><tt>tohostname</tt></a>
|
||||
functions from the DNS module are provided to convert between host names and IP addresses.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
@ -118,47 +118,47 @@ reassembled transparently on the other end. There are no boundaries in
|
||||
the data transfers. The library allows users to read data from the
|
||||
sockets in several different granularities: patterns are available for
|
||||
lines, arbitrary sized blocks or "read up to connection closed", all with
|
||||
good performance.
|
||||
good performance.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The library distinguishes three types of TCP sockets: <em>master</em>,
|
||||
<em>client</em> and <em>server</em> sockets.
|
||||
The library distinguishes three types of TCP sockets: <em>master</em>,
|
||||
<em>client</em> and <em>server</em> sockets.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Master sockets are newly created TCP sockets returned by the function
|
||||
<a href=tcp.html#tcp><tt>socket.tcp</tt></a>. A master socket is
|
||||
<a href=tcp.html#tcp><tt>socket.tcp</tt></a>. A master socket is
|
||||
transformed into a server socket
|
||||
after it is associated with a <em>local</em> address by a call to the
|
||||
<a href=tcp.html#bind><tt>bind</tt></a> method followed by a call to the
|
||||
<a href=tcp.html#listen><tt>listen</tt></a>. Conversely, a master socket
|
||||
can be changed into a client socket with the method
|
||||
<a href=tcp.html#connect><tt>connect</tt></a>,
|
||||
which associates it with a <em>remote</em> address.
|
||||
<a href=tcp.html#bind><tt>bind</tt></a> method followed by a call to the
|
||||
<a href=tcp.html#listen><tt>listen</tt></a>. Conversely, a master socket
|
||||
can be changed into a client socket with the method
|
||||
<a href=tcp.html#connect><tt>connect</tt></a>,
|
||||
which associates it with a <em>remote</em> address.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
On server sockets, applications can use the
|
||||
On server sockets, applications can use the
|
||||
<a href=tcp.html#accept><tt>accept</tt></a> method
|
||||
to wait for a client connection. Once a connection is established, a
|
||||
client socket object is returned representing this connection. The
|
||||
other methods available for server socket objects are
|
||||
<a href=tcp.html#getsockname><tt>getsockname</tt></a>,
|
||||
<a href=tcp.html#getsockname><tt>getsockname</tt></a>,
|
||||
<a href=tcp.html#setoption><tt>setoption</tt></a>,
|
||||
<a href=tcp.html#settimeout><tt>settimeout</tt></a>, and
|
||||
<a href=tcp.html#close><tt>close</tt></a>.
|
||||
<a href=tcp.html#settimeout><tt>settimeout</tt></a>, and
|
||||
<a href=tcp.html#close><tt>close</tt></a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Client sockets are used to exchange data between two applications over
|
||||
the Internet. Applications can call the methods
|
||||
the Internet. Applications can call the methods
|
||||
<a href=tcp.html#send><tt>send</tt></a> and
|
||||
<a href=tcp.html#receive><tt>receive</tt></a>
|
||||
<a href=tcp.html#receive><tt>receive</tt></a>
|
||||
to send and receive data. The other methods
|
||||
available for client socket objects are
|
||||
available for client socket objects are
|
||||
<a href=tcp.html#getsockname><tt>getsockname</tt></a>,
|
||||
<a href=tcp.html#getpeername><tt>getpeername</tt></a>,
|
||||
<a href=tcp.html#getpeername><tt>getpeername</tt></a>,
|
||||
<a href=tcp.html#setoption><tt>setoption</tt></a>,
|
||||
<a href=tcp.html#settimeout><tt>settimeout</tt></a>,
|
||||
<a href=tcp.html#shutdown><tt>shutdown</tt></a>, and
|
||||
@ -175,7 +175,7 @@ port (one that is chosen by the operating system) on the local host and
|
||||
awaits client connections on that port. When a connection is established,
|
||||
the program reads a line from the remote end and sends it back, closing
|
||||
the connection immediately. You can test it using the telnet
|
||||
program.
|
||||
program.
|
||||
</p>
|
||||
|
||||
<pre class=example>
|
||||
@ -217,68 +217,68 @@ error free. Data transfers are atomic, one datagram at a time. Reading
|
||||
only part of a datagram discards the rest, so that the following read
|
||||
operation will act on the next datagram. The advantages are in
|
||||
simplicity (no connection setup) and performance (no error checking or
|
||||
error correction).
|
||||
error correction).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Note that although no guarantees are made, these days
|
||||
networks are so good that, under normal circumstances, few errors
|
||||
networks are so good that, under normal circumstances, few errors
|
||||
happen in practice.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
An UDP socket object is created by the
|
||||
An UDP socket object is created by the
|
||||
<a href=udp.html#udp><tt>socket.udp</tt></a> function. UDP
|
||||
sockets do not need to be connected before use. The method
|
||||
<a href=udp.html#sendto><tt>sendto</tt></a>
|
||||
<a href=udp.html#sendto><tt>sendto</tt></a>
|
||||
can be used immediately after creation to
|
||||
send a datagram to IP address and port. Host names are not allowed
|
||||
because performing name resolution for each packet would be forbiddingly
|
||||
slow. Methods
|
||||
<a href=udp.html#receive><tt>receive</tt></a> and
|
||||
slow. Methods
|
||||
<a href=udp.html#receive><tt>receive</tt></a> and
|
||||
<a href=udp.html#receivefrom><tt>receivefrom</tt></a>
|
||||
can be used to retrieve datagrams, the latter returning the IP and port of
|
||||
the sender as extra return values (thus being slightly less
|
||||
efficient).
|
||||
efficient).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
When communication is performed repeatedly with a single peer, an
|
||||
application should call the
|
||||
application should call the
|
||||
<a href=udp.html#setpeername><tt>setpeername</tt></a> method to specify a
|
||||
permanent partner. Methods
|
||||
permanent partner. Methods
|
||||
<a href=udp.html#sendto><tt>sendto</tt></a> and
|
||||
<a href=udp.html#receivefrom><tt>receivefrom</tt></a>
|
||||
<a href=udp.html#receivefrom><tt>receivefrom</tt></a>
|
||||
can no longer be used, but the method
|
||||
<a href=udp.html#send><tt>send</tt></a> can be used to send data
|
||||
directly to the peer, and the method
|
||||
<a href=udp.html#receive><tt>receive</tt></a>
|
||||
<a href=udp.html#send><tt>send</tt></a> can be used to send data
|
||||
directly to the peer, and the method
|
||||
<a href=udp.html#receive><tt>receive</tt></a>
|
||||
will only return datagrams originating
|
||||
from that peer. There is about 30% performance gain due to this practice.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To associate an UDP socket with a local address, an application calls the
|
||||
<a href=udp.html#setsockname><tt>setsockname</tt></a>
|
||||
To associate an UDP socket with a local address, an application calls the
|
||||
<a href=udp.html#setsockname><tt>setsockname</tt></a>
|
||||
method <em>before</em> sending any datagrams. Otherwise, the socket is
|
||||
automatically bound to an ephemeral address before the first data
|
||||
transmission and once bound the local address cannot be changed.
|
||||
transmission and once bound the local address cannot be changed.
|
||||
The other methods available for UDP sockets are
|
||||
<a href=udp.html#getpeername><tt>getpeername</tt></a>,
|
||||
<a href=udp.html#getsockname><tt>getsockname</tt></a>,
|
||||
<a href=udp.html#getpeername><tt>getpeername</tt></a>,
|
||||
<a href=udp.html#getsockname><tt>getsockname</tt></a>,
|
||||
<a href=udp.html#settimeout><tt>settimeout</tt></a>,
|
||||
<a href=udp.html#setoption><tt>setoption</tt></a> and
|
||||
<a href=udp.html#close><tt>close</tt></a>.
|
||||
<a href=udp.html#setoption><tt>setoption</tt></a> and
|
||||
<a href=udp.html#close><tt>close</tt></a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Example:
|
||||
Example:
|
||||
</p>
|
||||
<blockquote>
|
||||
<p>
|
||||
A simple daytime client, using LuaSocket. The program connects to a remote
|
||||
server and tries to retrieve the daytime, printing the answer it got or an
|
||||
error message.
|
||||
error message.
|
||||
</p>
|
||||
|
||||
<pre class=example>
|
||||
@ -301,11 +301,11 @@ io.write(assert(udp:receive()))
|
||||
|
||||
<h3 id=more>Support modules</h3>
|
||||
|
||||
<p> Although not covered in the introduction, LuaSocket offers
|
||||
<p> Although not covered in the introduction, LuaSocket offers
|
||||
much more than TCP and UDP functionality. As the library
|
||||
evolved, support for <a href=http.html>HTTP</a>, <a href=ftp.html>FTP</a>,
|
||||
and <a href=smtp.html>SMTP</a> were built on top of these. These modules
|
||||
and many others are covered by the <a href=reference.html>reference manual</a>.
|
||||
and many others are covered by the <a href=reference.html>reference manual</a>.
|
||||
</p>
|
||||
|
||||
<!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||
|
@ -1,10 +1,10 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="description" content="LuaSocket: URL manipulation">
|
||||
<meta name="keywords" content="Lua, LuaSocket, URL, Library, Link, Network, Support">
|
||||
<meta name="keywords" content="Lua, LuaSocket, URL, Library, Link, Network, Support">
|
||||
<title>LuaSocket: URL support</title>
|
||||
<link rel="stylesheet" href="reference.css" type="text/css">
|
||||
</head>
|
||||
@ -28,7 +28,7 @@
|
||||
<a href="index.html#download">download</a> ·
|
||||
<a href="installation.html">installation</a> ·
|
||||
<a href="introduction.html">introduction</a> ·
|
||||
<a href="reference.html">reference</a>
|
||||
<a href="reference.html">reference</a>
|
||||
</p>
|
||||
</center>
|
||||
<hr>
|
||||
@ -36,21 +36,21 @@
|
||||
|
||||
<!-- url ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||
|
||||
<h2 id="url">URL</h2>
|
||||
<h2 id="url">URL</h2>
|
||||
|
||||
<p>
|
||||
The <tt>url</tt> namespace provides functions to parse, protect,
|
||||
and build URLs, as well as functions to compose absolute URLs
|
||||
from base and relative URLs, according to
|
||||
from base and relative URLs, according to
|
||||
<a href="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<p>
|
||||
To obtain the <tt>url</tt> namespace, run:
|
||||
</p>
|
||||
|
||||
<pre class=example>
|
||||
-- loads the URL module
|
||||
-- loads the URL module
|
||||
local url = require("socket.url")
|
||||
</pre>
|
||||
|
||||
@ -74,7 +74,7 @@ url.<b>absolute(</b>base, relative<b>)</b>
|
||||
</p>
|
||||
|
||||
<p class=description>
|
||||
Builds an absolute URL from a base URL and a relative URL.
|
||||
Builds an absolute URL from a base URL and a relative URL.
|
||||
</p>
|
||||
|
||||
<p class=parameters>
|
||||
@ -130,14 +130,14 @@ url.<b>build(</b>parsed_url<b>)</b>
|
||||
</p>
|
||||
|
||||
<p class=description>
|
||||
Rebuilds an URL from its parts.
|
||||
Rebuilds an URL from its parts.
|
||||
</p>
|
||||
|
||||
<p class=parameters>
|
||||
<tt>Parsed_url</tt> is a table with same components returned by
|
||||
<a href="#parse"><tt>parse</tt></a>.
|
||||
Lower level components, if specified,
|
||||
take precedence over high level components of the URL grammar.
|
||||
take precedence over high level components of the URL grammar.
|
||||
</p>
|
||||
|
||||
<p class=return>
|
||||
@ -152,10 +152,10 @@ url.<b>build_path(</b>segments, unsafe<b>)</b>
|
||||
|
||||
<p class=description>
|
||||
Builds a <tt><path></tt> component from a list of
|
||||
<tt><segment></tt> parts.
|
||||
<tt><segment></tt> parts.
|
||||
Before composition, any reserved characters found in a segment are escaped into
|
||||
their protected form, so that the resulting path is a valid URL path
|
||||
component.
|
||||
component.
|
||||
</p>
|
||||
|
||||
<p class=parameters>
|
||||
@ -165,8 +165,8 @@ characters are left untouched.
|
||||
</p>
|
||||
|
||||
<p class=return>
|
||||
The function returns a string with the
|
||||
built <tt><path></tt> component.
|
||||
The function returns a string with the
|
||||
built <tt><path></tt> component.
|
||||
</p>
|
||||
|
||||
<!-- escape +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||
@ -178,7 +178,7 @@ url.<b>escape(</b>content<b>)</b>
|
||||
<p class=description>
|
||||
Applies the URL escaping content coding to a string
|
||||
Each byte is encoded as a percent character followed
|
||||
by the two byte hexadecimal representation of its integer
|
||||
by the two byte hexadecimal representation of its integer
|
||||
value.
|
||||
</p>
|
||||
|
||||
@ -270,8 +270,8 @@ url.<b>parse_path(</b>path<b>)</b>
|
||||
</p>
|
||||
|
||||
<p class=description>
|
||||
Breaks a <tt><path></tt> URL component into all its
|
||||
<tt><segment></tt> parts.
|
||||
Breaks a <tt><path></tt> URL component into all its
|
||||
<tt><segment></tt> parts.
|
||||
</p>
|
||||
|
||||
<p class=description>
|
||||
@ -282,7 +282,7 @@ Breaks a <tt><path></tt> URL component into all its
|
||||
Since some characters are reserved in URLs, they must be escaped
|
||||
whenever present in a <tt><path></tt> component. Therefore, before
|
||||
returning a list with all the parsed segments, the function removes
|
||||
escaping from all of them.
|
||||
escaping from all of them.
|
||||
</p>
|
||||
|
||||
<!-- unescape +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||
@ -300,7 +300,7 @@ Removes the URL escaping content coding from a string.
|
||||
</p>
|
||||
|
||||
<p class=return>
|
||||
The function returns the decoded string.
|
||||
The function returns the decoded string.
|
||||
</p>
|
||||
|
||||
<!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||
|
Loading…
Reference in New Issue
Block a user