LuaSocket
Network support for the Lua language

home · download · introduction · reference


What is LuaSocket?

LuaSocket is a Lua extension library that is composed by two parts: a C layer that provides support for the TCP and UDP transport layers, and a set of Lua modules that add support for the SMTP (sending e-mails), HTTP (WWW access) and FTP (uploading and downloading files) protocols and other functionality commonly needed by applications that deal with the Internet.

Network support has been implemented so that it is both efficient and simple to use. LuaSocket can be used by any Lua application once it has been properly initialized by the interpreter running the Lua application. The code has been tested and runs well on several Windows and Unix platforms.

The library is available under the same terms and conditions 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.

Copyright © 1999-2004 Tecgraf/PUC-Rio. All rights reserved.
Author: Diego Nehab

Download

LuaSocket version 2.0 beta is now available for download! It is compatible with Lua 5.0 and has been tested on Windows XP, Linux, and Mac OS X.

The library can be downloaded in source code from the following links:

luasocket-2.0-beta.tar.gz
luasocket-2.0-beta.zip

Besides the full C and Lua source code for the library, the distribution contains several examples, this user's manual and the test procedures.

I am also providing a Windows binary for those that want to give LuaSocket a quick try:

luasocket-2.0.exe

This binary has been compiled with the LUASOCKET_DEBUG option, and should be able to run the automatic test procedures.

Special thanks

Throughout LuaSocket's history, many people gave sugestions that helped improve it. For that, I thank the Lua comunity. Special thanks go to David Burgess, who has pushed the library to a new level of quality and from whom I have learned a lot of stuff that doesn't show up in RFCs. Special thanks also to Carlos Cassino, who played a big part in the extensible design seen in the C core of LuaSocket 2.0.

What's New

Everything is new! Many changes for 2.0 happened in the C layer, which has been almost completely rewritten. The code has been ported to Lua 5.0 and greatly improved. There have also been some API changes that made the interface simpler and more consistent. Here are some of the changes that made it into version 2.0:

Lots of changes in the Lua modules, too. The new MIME and LTN12 modules make all other modules much more powerful. The main new functionality is the support for multipart messages in the SMTP module.

Incompatibilities with previous versions

Old Versions

All previous versions of the LuaSocket library can be downloaded here. Although these versions are no longer supported, they are still available for those that have compatibility issues.