In my understanding, IOLib and usocket have almost same abstraction level. IOLib uses OS-backend sockets, on the other hand usocket uses Lisp-runtime-backend socket.
I just wonder which is a better choice for particular use cases.
For example, a server which needs great concurrency, or a client which focuses on portability, etc.
I think, this blogpost answers your question.
To sum up, if you're writing a library, which should work on all platforms and implementations (with a reasonable definition of "all"), 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 had ported cl-redis from usocket to IOLib and back - the API is very similar, although slightly different.
The code for USOCKET is much smaller and simpler than IOLib including dependencies. IOLib uses CFFI bindings to Linux features which are not present in some *BSD for example.
All other things being equal, minimal source code is always preferable because it means less bugs, because it is easier to understand and hack. Simpler code is faster to debug, and deploys more easily.
Other than that, they both seem to work roughly the same : they both provide kqueue/select to handle multiple connections within a single thread. I'm not sure about more advanced functions, like passing a unix file descriptor in a socket.
I'd say if you only like Linux, go with IOLib or USOCKET, if you target Linux and/or *BSD, or other commercial operating systems, or like to Keep It Simple & Stupid, go with USOCKET.
If your main goal is portability, apparently usockets is better choice, since as it's stated on this page:
USOCKET is a networking portability layer for BSD-style sockets.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With