IOLib vs usocket

In my understanding, IOLib and usocket have almost the same level of abstraction. IOLib uses OS-backend sockets, on the other hand, usocket uses the Lisp -runtime-backend socket.

I'm just wondering which one is best for specific use cases.

For example, a server that needs a lot of concurrency, or a client that focuses on portability, etc.

+7
source share
3 answers

I think this blog post answers your question.

To summarize, if you are writing a library that should work on all platforms and implementations (with a reasonable definition of "everything"), use usocket. For other use cases on the Unix platform, IOLib is probably more versatile. For example, it supports Unix domain sockets, as well as non-blocking IO.

By the way, I ported cl-redis from usocket to IOLib and vice versa - the API is very similar, although it is slightly different.

+4
source

The code for USOCKET is much smaller and simpler than IOLib, including dependencies. IOLib uses CFFI bindings for Linux features that are not available in some * BSDs, for example.

All things being equal, a minimal source code is always preferable, because it means fewer errors, because it is easier to understand and crack. Simplified code is faster debugged and deployed more easily.

In addition, both of them seem to be approximately the same: both of them provide kqueue / select to handle multiple connections in the same thread. I'm not sure about more advanced features like passing a unix file descriptor to a socket.

I would say that if you like Linux, go with IOLIB or USOCKET, if you are targeting Linux and / or * BSD or other commercial operating systems or want it to be simple and stupid, go to USOCKET.

+2
source

If your main goal is portability, obviously this is the best choice, because, as he stated on this page :

USOCKET is a network portable layer for BSD sockets.

+1
source

All Articles