Jump to content
  • Advertisement


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


WSArecv() or recv()?

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

Which one should I use and why? The books i have on networking the only talk about recv, now I found WSArecv(), is there any difference? THanks, Nylren

Share this post

Link to post
Share on other sites
Depends on how complex your I/O strategy needs to be. WSARecv() allows two fundamental improvements over the traditional recv(): you can declare multiple receive buffers and a callback function to be summoned when all of the buffers have been filled (leading to greater efficiency if your program requires this kind of scatter-gather technique), and you can perform overlapped socket operations that allow you to queue multiple reads and wait for each individual completion by waiting on event handles. Also, WSARecv() tells you if there is more data waiting in the network buffer through the use of the lpFlags parameter (referred to as the MSG_PARTIAL flag). If you need this kind of functionality, feel free to switch over.

Simplistic receive operations may be performed with either function, but recv() is often the best and most straightforward choice if none of WSARecv()'s features are needed.

RapscallionGL - arriving soon.

[edited by - johnnie2 on March 7, 2003 7:58:12 PM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!