Screencast: Ruby's Socket API From the Outside In

Published on October 24, 2012 by Jesse Storimer

One of the reasons I love Ruby is the elegant DSLs and wrappers it provides around complex constructs. Socket programing is no exception.

In fact, this becomes really apparent when you look at socket programming. The low-level details and intricacies of the Socket APIs can be complex, but Ruby provides nice high level wrappers on top of the hard stuff.

In this screencast I show a really high level wrapper that Ruby provides for making TCP servers. I take 3 lines of high level code and break them down into 25 lines of lower level code. The pretty 3-liner won't work in all cases, so I walk you through the layers of abstractions until we go as low as we can (in Ruby).

If you like this, then you'll love my new book. It's all about socket programming in Ruby. Seriously, you should check it out.