Select calls seems to not time out.

Posted by martsbradley on Stack Overflow See other posts from Stack Overflow or by martsbradley
Published on 2010-03-31T12:00:46Z Indexed on 2010/03/31 12:03 UTC
Read the original article Hit count: 221

HI Folks,

I have a threaded C++ program where up to three threads are calling select on a three separate socket descriptors waiting for data to become available. Each thread handles one socket and adds it to the readfds with a timeout of 300 seconds. After select returns if there is data available I'm calling recv to read it.

Is there anything that I need to be aware of with winsock and threads because for some reason after a number of hours the select calls all seem to be not timing out. Can a multi threaded program select from a number of threads without issue?

I know that I should have one thread listening to all three sockets however that would be a large change for this app and I'm only looking to apply a bug fix.

cheers,

Martin.

© Stack Overflow or respective owner

Related posts about winsock

Related posts about multithreading