• Advertisement

Archived

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

WinSock Question

This topic is 5647 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

Advertisement
Theres also the concept of blocking vs non-blocking sockets.

Basically, if a socket is blocking (default for winsock I think), recv()s will wait until there is actually data available or a timeout occurs. That is not to say they will wait until ALL the data is available. You may still need to call them until all of the expected data arrives.

For non-blocking sockets, a call to recv() will return as much data as available that instant. It could be 0.

see select() too.

Share this post


Link to post
Share on other sites
recv() defaults to blocking, yes, which means it waits for a packet to be recv''d. As far as i know (and i''ve looked), there is no timeout to recv(). So, unless you''re doing non-blocking sockets, calling recv() every frame or iteration or whatever would probably be not good.

if you need to call recv() every frame and need blocking sockets (this is what i do), use select with a time value of 0:0 seconds. works well for me...

Share this post


Link to post
Share on other sites

  • Advertisement