Archived

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

Pres

select() with time out. Too little ?

Recommended Posts

Pres    122
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
Pres    122
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
azimuth    122
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