this is for debugging purposes.
To test that short send/short recv handling part of the code is working...
Is there a way to force Windows to produce short send/rcvs even for small number of bytes to be read/written from/to socket?
I prefer to do this per process, but if this cant be done per process Im ready to test how Firefox/ Outlook code handles this also. :)
Ofc I know I can manually add the huge msg to force this, but Im working on huge old code base that has layers of stuff so even adding a simple huge msg that is filled with random bytes is nontrivial. :)
You can change the size of the internal buffers used by
recv()
andsend()
by usingsetsockopt()
with the flagSO_RCVBUF
for therecv()
buffer and with the flagSO_SNDBUF
for thesend()
one.You can find an example here.
EDIT : You may want to disable the Nagle's algorithm. In this case, take a look at the mark's anwser.
EDIT2 : Like alk said in comment, it is important to change the buffers size before any call to
accept()
orconnect()
.