Try using select() before calling recv() or accept().
select() takes an array of file descriptors (includinig sockets) and returns when at least one of them is ready to receive. It can also return on a timeout.
In linux you can also try poll() (not sure if Winsock provides this).