Buffer management for socket application best practice
Posted
by Poni
on Stack Overflow
See other posts from Stack Overflow
or by Poni
Published on 2010-06-13T00:07:14Z
Indexed on
2010/06/13
0:12 UTC
Read the original article
Hit count: 289
networking
|buffer
Having a Windows IOCP app............
I understand that for async i/o operation (on network) the buffer must remain valid for the duration of the send/read operation.
So for each connection I have one buffer for the reading.
For sending I use buffers to which I copy the data to be sent. When the sending operation completes I release the buffer so it can be reused.
So far it's nice and not of a big issue.
What remains unclear is how do you guys do this?
Another thing is that even when having things this way, I mean multi-buffers, the receiver side might be flooded (talking from experience) with data.
Even setting SO_RCVBUF to 25MB didn't help in my testings.
So what should I do? Have a to-be-sent queue?
© Stack Overflow or respective owner