USOCKET - Universal socket library for Common Lisp

Goal

The project wants to provide a portable TCP/IP and UDP/IP socket interface for as many Common Lisp implementations as possible, while keeping the abstraction and portability layer as thin as possible. (IPv6 support is also in progress and already available for SBCL/CCL with version 0.6.3+)

Because trivial-sockets has been declared dead and its author has said he will declare usocket its successor if there is a zero effort path of migration, I'm also working on trivial-usocket which is supposed to be a sub-optimal, but zero effort migration from trivial-sockets.

If your lisp isn't mentioned in the list below, please feel free to submit a request for it at the mailing list mentioned below.

Comparison to other socket libraries

Since usocket is effectively the successor to trivial-sockets, see the feature comparison with trivial-sockets in order to find out which one you should use.

After starting the project, many others turned out to have worked on something alike, many times as part of a broader project or library. Some of them were known at the start of this project, others have been conceived after the usocket project already started. Not all of them have exactly the same portability goal.

See the Implementation comparison page for a comparison of the portability of other libraries and how that relates to usocket.

Documentation

See the documentation page for the API description.

Supported implementations

Currently these implementations are supported:

  1. Allegro CL
  2. ABCL (ArmedBear)
  3. Clasp
  4. Clozure CL (aka OpenMCL)
  5. Corman Lisp (based on :acl-socket module)
  6. GNU CLISP
  7. CMUCL
  8. ECL
  9. LispWorks (4.3 and up)
  10. Digitool MCL and RMCL (5.0 and up)
  11. Mezzano
  12. MKCL
  13. MOCL
  14. SBCL
  15. Scieneer CL (dead)
  16. Symbolics Lisp Machine (Genera)

Community

This project has started January 2006. There isn't much of a community yet, though I'd like there to be one. So, you're invited to join the mailing list, announce yourself and even join the effort!

Development discussion takes place on usocket-devel@common-lisp.net.

Project tracking happens on GitHub. Please take note of the guidelines before entering a bug or enhancement request into the database.

Development

Development will at least follow the steps outlined below. Yet to be determined is whether the currently mentioned steps will be enough to release version 1.0. Possibly, UDP sockets remain to be addressed before doing 1.0; that will depend on your reactions :-)

The targeted implementations listed in the status table below are not a final list: others can be added if/when the need or interest arises.

Active development is taking place on GitHub. To be kept up to date, please subscribe to the development mailing list. To use the latest development version, make sure you have git installed and execute this command:

 $ git clone https://github.com/usocket/usocket.git

Please send patches, bug reports and suggestions to the development mailing list address given above. The table below indicates the current state of development.

Status for the currently targeted backends
Major steps Socket implementations

Minor steps SBCL CMUCL ABCL CLISP Allegro
LispWorks CCL ECL Scieneer MCL
Minimal active sockets support at the same level as provided by trivial-sockets.
(Meaning streamed tcp traffic on connected sockets.)
Investigate interfaces provided. DONE DONE DONE DONE DONE DONE DONE DONE DONE DONE
Identify socket errors generated. DONE DONE DONE DONE DONE DONE DONE DONE DONE DONE
Implement active socket support. DONE DONE DONE DONE DONE DONE DONE DONE DONE DONE
Implement remapping of implementation defined errors. DONE DONE DONE DONE DONE DONE DONE DONE DONE DONE
Implementation test-suite status PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS
Add functions to retrieve socket properties:
Local and remote IP address and port.
Investigate interfaces provided DONE DONE DONE DONE DONE DONE DONE DONE DONE DONE
Implement it. DONE DONE DONE DONE DONE DONE DONE DONE DONE DONE
Implementation test-suite status PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS
Add support for passive (connection-accepting/server) sockets. Investigate interfaces provided DONE DONE DONE DONE DONE DONE DONE DONE DONE DONE
Implement api calls listen and accept DONE DONE DONE DONE DONE DONE DONE DONE DONE DONE
Implement api calls get- and setsockopt (or equivalent). DONE DONE DONE DONE DONE DONE DONE DONE DONE DONE
Implement efficient waiting for multiple sockets in one function call (select() like behavior). Investigate interfaces provided DONE DONE DONE DONE DONE DONE DONE DONE DONE DONE
Implement wait-for-input api. DONE DONE DONE DONE DONE DONE DONE DONE DONE DONE
Implement more uncommon API calls for TCP streams. send, recv TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO
shutdown WIP WIP WIP WIP WIP WIP WIP WIP WIP WIP
Implement UDP socket support. Investigate API's provided DONE DONE DONE DONE DONE DONE DONE DONE DONE DONE
Build on top of that (or custom ffi). DONE DONE DONE DONE DONE DONE DONE DONE DONE DONE
Implement IPv6 support
Implementation on platforms other than SBCL/CCL; API polish
DONE
WIP
WIP
WIP
WIP 2
DONE DONE
WIP
WIP
N/A

Interface guarantees

The interfaces currently published in the :export part of the package definition are guaranteed to stay compatible for the entire 0.x lifecycle. Extention in a backward compatible way is of course valid, as is the addition of new interface functions.

Releases

Current release

Releases are uploaded to the releases/ directory. You can find short descriptions in the table below:

USOCKET Release History
Date Release Summary
Mar 20, 2024
0.8.7
Cumulative bugfixes
Mar 1, 2023
0.8.6
Cumulative bugfixes for SBCL, LispWorks, Clozure CL, etc.
Sep 14, 2022
0.8.5
Cumulative bugfixes for latest versions of SBCL, CCL, ABCL, etc.
Mar 13, 2022
0.8.4
New backend: MKCL; Lots of accumulated bugfix (more than two years) for LispWorks, SBCL, CCL, etc.
Dec 23, 2019
0.8.3
New backend: Mezzano; Fixes of WAIT-FOR-INPUT for ECL and the single-socket optimization.
Jun 11, 2019
0.8.2
Fixed WAIT-FOR-INPUT for single-socket case in SBCL & LW (on Windows); Exported host-or-ip slot of NS-CONDITION.
Feb 27, 2019
0.8.1
New backend: clasp; Fixed loading usocket.asd in SBCL 1.5.0
Feb 5, 2019
0.8
New backend (experimental): IOlib; Enhanced WAIT-FOR-INPUT on single socket.
Aug 31, 2018
0.7.1
New backend: Symbolics Lisp Machine; Host resolving APIs prefer IPv4 in mixed environment; Fixed wait-for-input on Windows for SBCL/ECL
Oct 25, 2016
0.7.0
Separated client and server packages. Enhanced supports on all LispWorks versions; bugfixes on CLISP, CCL and ECL.
Oct 19, 2016
0.6.5
Added support for (SOCKET-OPTION :READ-TIMEOUT); fixed SOCKET_SHUTDOWN in LispWorks; fixed loading in LispWorks old versions (5.x, 6.x)
Mar 17, 2016
0.6.4
New API: SOCKET-SHUTDOWN; added IPv6 support for SBCL (and Clozure CL); minimal support for Corman Lisp; minor fixes for LW, SBCL, ECL.
May 23, 2015
0.6.3
Further CCL 1.11 compatibility; minor fixes for ECL; improved SOCKET-SEND and SOCKET-RECEIVE on LispWorks
Apr 20, 2015
0.6.2
CCL 1.11 compatibility; minor fixes for ECL and LispWorks.
Jun 21, 2013
0.6.1
Initial MOCL support; initial MCL UDP support; improved SOCKET-OPTION; bugfix for CCL backend.
Dec 26, 2012
0.6.0
New API: SOCKET-OPTION; Add support for ECL DFFI mode; bugfix for LispWorks, CLISP, ABCL, ECL.
Feb 27, 2012
0.5.5
LispWorks 6.1 compatibility; SOCKET-CONNECT argument :nodelay can now set to :if-supported
Oct 1, 2011
0.5.4
Minor fixes for ECL, Allegro CL modern mode, and SBCL.
Aug 13, 2011
0.5.3
Fixed "SBCL data flush problem"; Important fixes for MCL and LispWorks (delivery mode).
May 11, 2011
0.5.2
Fixed WAIT-FOR-INPUT for CLISP which made Hunchentoot working; Lots of bugfix for SBCL, ECL, ABCL and LispWorks.
Apr 2, 2011
0.5.1
Improved CLISP support using FFI; Lots of bugfix for CMUCL, SBCL, LispWorks, etc.
Mar 12, 2011 0.5.0 UDP support; Lots of bugfixes since 0.4.1; support for WAIT-FOR-INPUT for SBCL and ECL on Win32; new platform added: Macintosh Common Lisp (5.0 and up)
Dec 27, 2008 0.4.1 fixes for ECL, LispWorks, SBCL, SCL
Oct 28, 2008 0.4.0 select()-like api: make a single thread wait for multiple sockets.
various socket options for socket-creation with SOCKET-CONNECT.
Jun 21, 2008 0.3.6 Code fixups based on advice from the ECL and OpenMCL maintainers. New exported symbols: WITH-MAPPED-CONDITIONS, NS-CONDITION, NS-ERROR, NS-UNKNOWN-ERROR and NS-UNKNOWN-CONDITION.
Jul 25, 2007 0.3.4 Fix clisp get-host-name, multiple ECL fixes.
Jun 05, 2007 0.3.3 Fix where host resolution routine was unable to resolve would return NIL instead of erroring.
Mar 04, 2007 0.3.2 Fixes for many backends related to closing sockets. LispWorks fix for broken server sockets. API guarantee adjustments in preparation of porting Drakma.
Feb 28, 2007 0.3.1 fixed with-server-socket; prevent creation of invalid sockets; 2 more convenience macros.
Feb 26, 2007 re-release Re-release of 0.2.3, 0.2.4, 0.2.5 and 0.3.0 tarballs because the originals included Subversion administration areas.
Jan 21, 2007 0.3.0 Server sockets
Jan 19, 2007 0.2.5 Allegro compilation fix.
Jan 17, 2007 0.2.4 Various fixes for CMUCL, OpenMCL, Allegro and LispWorks.
Jan 04, 2007 0.2.3 Add :element-type support to support stacking flexi-streams on socket streams for portable :external-format support.
Jan 03, 2007 0.2.2 Add ECL support and a small SBCL bugfix.
Dec 21, 2006 0.2.1 Remove 'open-stream' interface which is supposed to be provided by the 'trivial-usocket' package.
Dec 18, 2006 0.2.0 Add support for Scieneer Common Lisp, fix issue #6 and API preparation for server side sockets (not in this release)
Feb 13, 2006 0.1.0 Initial release

Project History

Long ago the project was conceived and started by Erik Enge in an attempt to factor out all implementation specific sockets code from cl-irc. This 'long ago' must have been way before 2003 when I entered the cl-irc project.

In January 2006, Erik Huelsmann found Erik Enge willing to donate the code he had still laying around to restart the project. The restart took place at the 27th of January when the old code was imported into the public repository.

Starting from 2008, Chun Tian (binghe) joined into usocket development team with his UDP/IP code base.

With 0.6.0 release, this project, "where it started as an intersection of the functionality available on different platforms, now slowly moving to the union of all functionality available on all different implementations" (Erik Huelsmann).

With 0.6.2 release, Hans Huebner added basic IPv6 support for SBCL and Clozure CL, based on the IPv6 feature provided in new versions of SBCL/CCL and LispWorks.


Back to Common-lisp.net.
Valid XHTML 1.0 Strict