Jump to content

  • Log In with Google      Sign In   
  • Create Account


Select() with a small timeout VS non-blocking sockets


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Tessellator   Members   -  Reputation: 578

Like
0Likes
Like

Posted 05 July 2006 - 11:09 PM

This is a question out of curiosity more than anything else. Because windows doesn't implement the fcntl() function (and I didn't know about the ioctlsocket() function to do the same) I simply did a select() with a timeout of 1 microsecond which seemed to work fine. Are there any benifits to using blocking sockets with a really small timeout on select() calls like this? Or is it better to make them non-blocking and just poll recv() etc rather than select()? I'm quite a newbie in this area, but I decided to learn a bit after 3d coding at home started to become a bit dull :). T

Sponsor:

#2 John Schultz   Members   -  Reputation: 807

Like
0Likes
Like

Posted 05 July 2006 - 11:55 PM

After simple benchmarking, I found that non-blocking sockets were slightly faster than blocking sockets with select(), though the difference won't likely make a difference in a game application. If you use select(), set the timeout to 0 (no need to waste even 1us if no data is ready).

#3 Tessellator   Members   -  Reputation: 578

Like
0Likes
Like

Posted 06 July 2006 - 01:26 AM

Cool, thanks for that. Non-blocking it is then :).

Cheers,
T




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS