2003-08-31 03:00:15 +02:00
|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
|
|
|
"http://www.w3.org/TR/html4/strict.dtd">
|
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
2004-06-21 08:07:58 +02:00
|
|
|
<meta name="description" content="The LuaSocket Homepage">
|
2004-11-28 09:17:16 +01:00
|
|
|
<meta name="keywords" content="Lua, LuaSocket, Network, Library, Support, Internet">
|
2003-08-31 03:00:15 +02:00
|
|
|
<title>LuaSocket: Network support for the Lua language </title>
|
|
|
|
<link rel="stylesheet" href="reference.css" type="text/css">
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<!-- header +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
|
|
|
|
|
|
<div class=header>
|
|
|
|
<hr>
|
|
|
|
<center>
|
|
|
|
<table summary="LuaSocket logo">
|
|
|
|
<tr><td align=center><a href="http://www.lua.org">
|
2004-06-21 08:07:58 +02:00
|
|
|
<img width=128 height=128 border=0 alt="LuaSocket" src="luasocket.png">
|
2003-08-31 03:00:15 +02:00
|
|
|
</a></td></tr>
|
|
|
|
<tr><td align=center valign=top>Network support for the Lua language
|
|
|
|
</td></tr>
|
|
|
|
</table>
|
|
|
|
<p class=bar>
|
|
|
|
<a href="home.html">home</a> ·
|
|
|
|
<a href="home.html#download">download</a> ·
|
2004-11-28 09:17:16 +01:00
|
|
|
<a href="instalation.html">instalation</a> ·
|
2003-08-31 03:00:15 +02:00
|
|
|
<a href="introduction.html">introduction</a> ·
|
|
|
|
<a href="reference.html">reference</a>
|
|
|
|
</p>
|
|
|
|
</center>
|
|
|
|
<hr>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- whatis +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
|
|
|
|
|
|
<h2 id=whatis>What is LuaSocket?</h2>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
LuaSocket is a <a href="http://www.lua.org">Lua</a> extension library
|
2004-06-16 06:28:21 +02:00
|
|
|
that is composed by two parts: a C core that provides support for the TCP
|
2003-08-31 03:00:15 +02:00
|
|
|
and UDP transport layers, and a set of Lua modules that add support for
|
2004-06-16 06:28:21 +02:00
|
|
|
functionality commonly needed by applications that deal with the Internet.
|
2003-08-31 03:00:15 +02:00
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>
|
2004-06-16 06:28:21 +02:00
|
|
|
The core support has been implemented so that it is both efficient and
|
|
|
|
simple to use. The core can be used by any Lua application once it has
|
2004-06-16 01:00:56 +02:00
|
|
|
been properly initialized by the interpreter running the
|
2003-08-31 03:00:15 +02:00
|
|
|
Lua application. The code has been tested and runs well on several Windows
|
|
|
|
and Unix platforms.
|
|
|
|
</p>
|
|
|
|
|
2004-06-16 06:28:21 +02:00
|
|
|
<p>
|
2004-06-16 22:41:03 +02:00
|
|
|
The most used modules implement the
|
|
|
|
<a href=smtp.html>SMTP</a>
|
|
|
|
(sending e-mails),
|
|
|
|
<a href=http.html>HTTP</a>
|
|
|
|
(WWW access) and
|
|
|
|
<a href=ftp.html>FTP</a>
|
|
|
|
(uploading and downloading files) client
|
2004-06-16 06:28:21 +02:00
|
|
|
protocols. These provide a very natural and generic interface to the e
|
|
|
|
functionality covered by the protocols.
|
2004-06-16 22:41:03 +02:00
|
|
|
In addition, you will find that the
|
|
|
|
<a href=mime.html>MIME</a> (common encodings),
|
|
|
|
<a href=url.html>URL</a>
|
|
|
|
(anything you could possible want to do with one) and
|
|
|
|
<a href=ltn12.html>LTN12</a>
|
|
|
|
(filters, sinks, sources and pumps) modules can be very handy.
|
2004-06-16 06:28:21 +02:00
|
|
|
</p>
|
|
|
|
|
2003-08-31 03:00:15 +02:00
|
|
|
<p>
|
|
|
|
The library is available under the same
|
|
|
|
<a href="http://www.lua.org/copyright.html">
|
|
|
|
terms and conditions</a> as the Lua language, the MIT license. The idea is
|
|
|
|
that if you can use Lua in a project, you should also be able to use
|
|
|
|
LuaSocket.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>
|
2004-11-28 09:17:16 +01:00
|
|
|
Copyright © 2004 Diego Nehab. All rights reserved. <br>
|
2003-08-31 03:00:15 +02:00
|
|
|
Author: <A href="http://www.cs.princeton.edu/~diego">Diego Nehab</a>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<!-- download +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
|
|
|
2004-01-20 21:24:51 +01:00
|
|
|
<h2 id=download>Download</h2>
|
2003-08-31 03:00:15 +02:00
|
|
|
|
|
|
|
<p>
|
2004-11-28 09:17:16 +01:00
|
|
|
LuaSocket version 2.0 (beta3) is now available for download! It is
|
2003-08-31 03:00:15 +02:00
|
|
|
compatible with Lua 5.0 and has been tested on
|
|
|
|
Windows XP, Linux, and Mac OS X.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
The library can be downloaded in source code from the following links:
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<blockquote>
|
|
|
|
<p>
|
2004-11-28 09:17:16 +01:00
|
|
|
<a href="luasocket-2.0-beta3.tar.gz">luasocket-2.0-beta3.tar.gz</a> <br>
|
|
|
|
<a href="luasocket-2.0-beta3.zip">luasocket-2.0-beta3.zip</a>
|
2003-08-31 03:00:15 +02:00
|
|
|
</p>
|
|
|
|
</blockquote>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
Besides the full C and Lua source code for the library, the distribution
|
|
|
|
contains several examples, this user's manual and the test procedures.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>
|
2004-06-18 23:41:51 +02:00
|
|
|
I am also providing PC Win32 binaries for those that want to give
|
2003-08-31 03:00:15 +02:00
|
|
|
LuaSocket a quick try:
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<blockquote>
|
|
|
|
<p>
|
2004-11-28 09:17:16 +01:00
|
|
|
<a href="luasocket-2.0-beta3-win32.zip">luasocket-2.0-beta3-win32.zip</a>
|
2003-08-31 03:00:15 +02:00
|
|
|
</p>
|
|
|
|
</blockquote>
|
|
|
|
|
|
|
|
<p>
|
2004-06-18 23:41:51 +02:00
|
|
|
The quick and dirty way to use these binaries is to unpack everything into a
|
|
|
|
directory, say <tt>c:\luasocket</tt> (include all Lua files from the
|
|
|
|
LuaSocket distrbitution in the same directory too!).
|
2004-11-28 09:17:16 +01:00
|
|
|
Then set <tt>LUA_INIT</tt> to load the <tt>compat-5.1.lua</tt> and set
|
|
|
|
<tt>LUA_PATH</tt> and <tt>LUA_CPATH</tt> to look for files in that
|
|
|
|
directory:
|
2003-08-31 03:00:15 +02:00
|
|
|
</p>
|
|
|
|
|
2004-06-18 23:41:51 +02:00
|
|
|
<pre class=example>
|
2004-11-28 09:17:16 +01:00
|
|
|
c:\luasocket\> set LUA_INIT=@compat-5.1.lua
|
|
|
|
c:\luasocket\> set LUA_CPATH=?.dll
|
|
|
|
c:\luasocket\> set LUA_PATH=?.lua
|
2004-06-18 23:41:51 +02:00
|
|
|
</pre>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
From that directory, you can then run the interpreter and it should find all
|
|
|
|
files it needs. To download this manual page from the Internet, for example,
|
|
|
|
do the following:
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<pre class=example>
|
|
|
|
c:\luasocket\> lua
|
|
|
|
Lua 5.0.2 Copyright (C) 1994-2004 Tecgraf, PUC-Rio
|
|
|
|
> http = require"http"
|
|
|
|
> print(http.request"http://www.tecgraf.puc-rio.br/luasocket/")
|
2004-11-28 09:17:16 +01:00
|
|
|
--> this gets dumped to terminal
|
2004-06-18 23:41:51 +02:00
|
|
|
</pre>
|
|
|
|
|
2004-11-28 09:17:16 +01:00
|
|
|
<p> Take a look at the <a href=instalation.html>installation</a> section of
|
|
|
|
the manual to find out how to properly install the library after you are
|
|
|
|
done playing with it. </p>
|
|
|
|
|
2004-02-04 15:29:11 +01:00
|
|
|
<!-- thanks +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
|
|
|
|
|
|
<h2 id=thanks>Special thanks</h2>
|
|
|
|
|
|
|
|
<p>
|
2004-06-16 06:28:21 +02:00
|
|
|
Throughout LuaSocket's history, many people gave suggestions that helped
|
|
|
|
improve it. For that, I thank the Lua community.
|
2004-02-04 15:29:11 +01:00
|
|
|
Special thanks go to
|
2004-06-16 06:28:21 +02:00
|
|
|
David Burgess, who has helped push the library to a new level of quality and
|
2004-06-16 01:00:56 +02:00
|
|
|
from whom I have learned a lot of stuff that doesn't show up in RFCs.
|
2004-02-04 15:29:11 +01:00
|
|
|
Special thanks also to Carlos Cassino, who played a big part in the
|
2004-07-26 06:04:04 +02:00
|
|
|
extensible design seen in the C core of LuaSocket 2.0. Recently, Mike Pall
|
|
|
|
has been helping a lot too! Thanks to you all!
|
2004-02-04 15:29:11 +01:00
|
|
|
</p>
|
|
|
|
|
2003-08-31 03:00:15 +02:00
|
|
|
<!-- whatsnew +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
|
|
|
|
|
|
<h2 id=new>What's New</h2>
|
|
|
|
|
2004-06-16 01:00:56 +02:00
|
|
|
<p>
|
2004-11-28 09:17:16 +01:00
|
|
|
The big change for the 2.0 (beta3) release was the adoption of the Lua 5.1
|
|
|
|
package proposal. There were several bug fixes too (a beta is a
|
|
|
|
beta, is a beta).
|
2004-06-16 01:00:56 +02:00
|
|
|
</p>
|
|
|
|
|
|
|
|
<ul>
|
2004-11-28 09:17:16 +01:00
|
|
|
<li> New compat-5.1 distribution:
|
|
|
|
<ul>
|
|
|
|
<li> Instalation uses new directory structure;
|
|
|
|
<li> Namespace hierarchy is in now back in use (ex. <tt>socket.url</tt>
|
|
|
|
instead of <tt>url</tt>);
|
|
|
|
<li> Globals not visible from inside namespaces;
|
|
|
|
<li> All modules call <tt>require</tt> even for standard libraries;
|
|
|
|
</ul>
|
|
|
|
<li> LTN12 avoids coroutines (so you can go wild on the C side);
|
|
|
|
<li> Kludge on wsocket.c:sock_send for windows timeout issue
|
|
|
|
moved to buffer.c:sendraw;
|
|
|
|
<li> <tt>socket.protect </tt>only catches errors thrown by <tt>socket.try</tt>;
|
|
|
|
<li> Fixed <tt>udp:sendto</tt> to call <tt>sock_sendto</tt> instead of
|
|
|
|
<tt>sock_send</tt>;
|
|
|
|
<li> <tt>close</tt> wasn't returning 1!
|
|
|
|
<li> <tt>socket.gettime</tt> returns time since Unix Epoch 1/1/1970 (UTC)
|
|
|
|
<li> <tt>socket.sleep</tt> is robust to interrupts;
|
|
|
|
<li> <tt>socket.select</tt> wasn't calling <tt>tm_markstart</tt>;
|
|
|
|
<li> <tt>http.PROXY</tt> etc wasn't working.
|
2003-08-31 03:00:15 +02:00
|
|
|
</ul>
|
|
|
|
|
|
|
|
<!-- incompatible +++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
|
|
|
|
|
|
<h3 id=incompatible>Incompatibilities with previous versions</h3>
|
|
|
|
|
|
|
|
<ul>
|
2004-11-28 09:17:16 +01:00
|
|
|
<li> Namespaces are hierarchical again. This means that whoever called
|
|
|
|
<tt>require("url")</tt> should update their code to
|
|
|
|
<tt>require("socket.url")</tt>.
|
2003-08-31 03:00:15 +02:00
|
|
|
</ul>
|
|
|
|
|
|
|
|
<!-- old ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
|
|
|
|
|
|
<h2 id=old>Old Versions</h2>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
All previous versions of the LuaSocket library can be downloaded
|
|
|
|
<a href="http://www.tecgraf.puc-rio.br/luasocket/old">here</a>. Although
|
|
|
|
these versions are no longer supported, they are still available for
|
|
|
|
those that have compatibility issues.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
|
|
|
|
|
|
<div class=footer>
|
|
|
|
<hr>
|
|
|
|
<center>
|
|
|
|
<p class=bar>
|
|
|
|
<a href="home.html#down">download</a> ·
|
2004-11-28 09:17:16 +01:00
|
|
|
<a href="home.html#download">download</a> ·
|
|
|
|
<a href="instalation.html">instalation</a> ·
|
2003-08-31 03:00:15 +02:00
|
|
|
<a href="introduction.html">introduction</a> ·
|
|
|
|
<a href="reference.html">reference</a>
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
<small>
|
|
|
|
Last modified by Diego Nehab on <br>
|
2004-06-17 09:00:43 +02:00
|
|
|
Thu Jun 17 02:47:14 EDT 2004
|
2003-08-31 03:00:15 +02:00
|
|
|
</small>
|
|
|
|
</p>
|
|
|
|
</center>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|