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


WSArecv() or recv()?

Recommended Posts

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