From: Ari Brown [mailto:ari / aribrown.com] 
# - Is there a (slightly) easier way to do it, or should I just start  
# writing a wrapper?

you might want to take a peek at EventMachine..
kind regards -botp