Since I am not a native English speaker, I might miss something, so maybe someone here knows me better.
Adapted from WSASend to add to MSDN:
lpBuffers [in]
Pointer to an array of WSABUF structures. Each WSABUF structure contains a pointer to a buffer and the length, in bytes, of the buffer. For a Winsock application after WSASend, a function is called which system buffers belong to and the application may not access them . This array must remain valid during the send operation.
Ok, can you see the bold text? This is an obscure place!
I can think of two translations for this line (maybe something else, you name it):
Translation 1 - "buffers" refers to the OVERLAPPED structure that I pass to this function when it is called. I can reuse the object again only when I receive a completion notification. Translation 2 - βbuffersβ refer to actual buffers , to those from whom data is transmitted. If the WSABUF object points to a single buffer, I cannot touch this buffer until the operation is complete.
Can anyone say what is the correct interpretation of this line?
And ..... If the answer is second - how do you resolve it?
Because for me, this implies that for every data / buffer I send, I have to keep a copy of it on the sender side - thus having many "pending" buffers (in different sizes) in a high-traffic application that really goes to corrupt " scalability. "
Statement 1:
In addition to the paragraph above ("AND ...."), I thought IOCP copies the data that will be sent to its own buffer, and sends from there if you do not set SO_SNDBUF to zero.
Statement 2:
I use buffered stacks (you know, something like char cBuff[1024]; in the body of the function - if the translation to the main question is the second option (i.e., buffers should remain as they are until the transfer will not be completed), then ... what really makes you think about the big time! Can you come up with a way to solve it? (I know, I asked him in other words).