Support for Scatter/Gather Input/Output in the SPI
A version of this page is also available for
4/8/2010
The WSPSend, WSPSendTo, WSPRecv, and WSPRecvFrom routines all take an array of client buffers as input parameters and thus may be used for scatter/gather (or vectored) I/O. This can be very useful in instances where portions of each message being transmitted consist of one or more fixed length headers in addition to a message body. Such headers need not be concatenated into a single contiguous buffer prior to sending. Likewise on receiving, the headers can be automatically split off into separate buffers, leaving the message body pure.
Utilizing lists of buffers instead of a single buffer does not change the boundaries that apply to receive operations. For message-oriented protocols, a receive operation completes whenever a single message has been received, regardless of how many or few of the supplied buffers were used. Likewise for stream-oriented protocols, a receive completes when an unspecified quantity of bytes arrives over the network, not necessarily when all of the supplied buffers are full.