Next: , Previous: cffi-grovel concepts, Up: Top


4 Differences from trivial-sockets

Trivial-Sockets is a related project with the aim of providing a uniform interface to basic networking features. It is based on a thin portability layer, rather than on using underlying platform features like cffi-net is; this inherently makes it more difficult to maintain and keep up-to-date. We have tried to make porting from trivial-sockets as simple as possible.

The functions (open-server), (close-server), and (accept-connection) are all approximately compatible with their Trivial-Sockets counterparts. Trivial-Sockets also has (open-stream) and (resolve-hostname), which will soon be part of Cffi-Net as well, but are not implemented yet.

Cffi-Net's (open-server) supports the options :host, :port, :reuse-address, :max-backlog, and :protocol. Trivial-Sockets supports all of these, except that it calls :max-backlog :backlog and has a different default value. Cffi-Net currently ignores :protocol, always treating it as if it's :tcp. Trivial-Sockets on most platforms will signal an error if anything but :tcp is given.

Cffi-Net does not support any options for (accept-connection). Trivial-Sockets supports :external-format and :element-type, with behavior that differs across Lisp implementations. Cffi-Net sockets are bivalent, meaning that, for example, both (read-char) and (read-byte) work on them. Character-encoding issues will have to be dealt with at some point, but it is not yet clear what the appropriate interface will be.

In the current release, only OpenMCL is supported. This is due to the difficulty of hooking into each Lisp implementation's streams system. Work is ongoing to support sbcl as well. Necessarily, this entails significant poking at internals. Patches welcome. Our intent is to first put together a uniform stream-extension interface, then attempt to have it adopted by each upstream Lisp implementation to reduce maintenance requirements.