Archived

This topic is now archived and is closed to further replies.

select() with time out. Too little ?

This topic is 5238 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m giving 1000 micro secs for a read/write flag to fall. Seems to time out all the time. Am I being too stingy here or is there a bug in my code ?

Share this post


Link to post
Share on other sites
Yes, 1 millisecond.
Pings on the test network are about 16 milliseconds.

So select will in fact time out without even having a look, as it were ?

Share this post


Link to post
Share on other sites
A pretty good maximum is 1 second, actually, though if you''re going to be dealing with a fast connection you could squeeze it down to 150 ms or so (that''s 150,000 microseconds).

The only reason I ever use the timeout feature is when I want a portable way to make the process sleep for a small amount of time. Usually, I want the program to see if there''s something available NOW so it can do other things while it''s waiting for input.

Share this post


Link to post
Share on other sites