Got it working using a simple time out with select();

See Andreas Masur's post:

http://www.codeguru.com/forum/showth...ht=SO_RCVTIMEO