< Previous | Next >
April 2, 2010 12:10 PM CDT by psilord in category Lisp

Network Programming in Common Lisp with IOLib

The other day some months ago, I had a hankering to write some distributed computing frameworks in the 10K to 50K machine range in Common Lisp. I have some applications in mind for such things.

Of course, the first thing someone thinks about when designing such a system is "Should I mix my Coca Cola with Bacardi 151 or instead this rubbing alcohol I have here for cleaning my electronics?". Ok, the second thing someone thinks about is "How are all of the agents going to robustly talk to each other and handle network boundary cases?"

This means Network Programming. Calm down, there are books for that. What I needed was a nice solution in Common Lisp. I looked around and of course each implementation of Common Lisp has its own socket API, but I wanted something more portable between implementations. I didn't care so much about portability between operating systems, though. Linux (and a bottle of pills) is just fine for me.

I settled, like a wet cough in the lungs, on IOLib. This Common Lisp library can do a lot of things: IPV4, IPV6, UDP, DNS resolving, and most importantly, multiplex nonblocking I/O with multiple clients. The last thing I wanted to do was reinvent an I/O event multiplexer....

I dove into the manual, and uh, whoops, yeah, about that. At the time of this blog post, the manual was a bit thin. It suffered from the same affliction about 99.9% of other open source manuals do, an out of date API list, and not much else. Such is the nature of open source documentation. It is like being pissed off the sky is blue.

This time, instead of complaining about it, I did something about it. Open source, if you squint, also means contributing documentation as well.

After conversing with the author of IOLib (Stelian Ionescu) for extended periods of time while he disentangled the stupid I was spewing from my pie-hole, I produced a TUTORIAL for IOLib! This tutorial shows client/server examples for blocking I/O and nonblocking I/O with the multiplexer. The example source codes are available in the current release of IOLib available from the aforementioned site. Sorry about the formatting, I can't bring myself to htmlify it yet (it took a couple months to write and I just don't want to look at it for a while), maybe in some future revision of it I will. Of course, once the tutorial gets incorporated into a more formal discovery system on the IOLib website, I'll provide a link at the top of the tutorial's specific page to point to it so someone always find the most current one.

It is also newbie friendly to Common Lisp coders (mostly, because, um, I'm a newbie to Common Lisp at the moment so I wrote for my audience). I'm quite certain I've left important crap I shouldn't have out of the tutorial, so if you find something you just don't understand, let me know at the email address in the tutorial and I'll clarify it.

As I got to really know IOLib, I found that it was a really useful library. It sits at just the right abstraction level for the things for which I need it and turns out to be pretty simple to use and quite fast. The author is friendly, knowledgeable, and willing to accept contributions. Try it out!

End of Line.

< Previous | Next >