you could set the socket to non-blocking mode. that way, it would always return immediately with whatever data was there (or return an error if nothing is there).
by default sockets are in blocking mode, so calls to recv() will block indefinitely until *at least* one byte is received.
another alternative is to use timeouts, but in my experience they are not very accurate and i wouldn''t recomend using them for something like an fps.
I know about non-blocking sockets, but is there a way to not have to poll those sockets for data? One of the reasons I use event-based ones is so I can spend CPU time elsewhere instead of checking the sockets all the time.
Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
September 29, 2002 02:52 AM
Only way i know is using select().
But as far as your problem goes, it''s very strange. If you''re still having that problem, i would have to say there may be a bug in your code causing it to wait somewhere for all the data (or wait for it to be sent..whatever) because i''ve never seen/heard of sockets/winsock doing this. Even the nagle algortihm doesn''t stop data indefinately, it only delays it for like 100ms or something...
But as far as your problem goes, it''s very strange. If you''re still having that problem, i would have to say there may be a bug in your code causing it to wait somewhere for all the data (or wait for it to be sent..whatever) because i''ve never seen/heard of sockets/winsock doing this. Even the nagle algortihm doesn''t stop data indefinately, it only delays it for like 100ms or something...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement