Ahem, the type is called fdset, not struct fd_set
Use sigaction instead of signal
Add 'length' parameter in hostname() and service() helper functions
Add _BSD_SOURCE define to get NI_MAXHOST/SERV
Add missing include for fd_set declaration