select() with time out. Too little ?
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 ?
Microseconds? As in millionths of a second? Uh, yeah, you''re being too stingy.
Tony
Tony
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 ?
Pings on the test network are about 16 milliseconds.
So select will in fact time out without even having a look, as it were ?
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement