If you want to know the nitty gritty details of how to do this, I 
recommend "Advanced Programming in the Unix Environment" by W. Richard 
Stevens.  Or the "Unix Network Programming" series by the same guy.

Brian