Archived

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

FrancoisSoft

WinSock Question

Recommended Posts

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