<div dir="ltr">If you are lucky. They still may be merged by sender if retransmission occurs, or on receiving side, if receiver waits too long before reads, and this is up to OS scheduler to control.<div>NDELAY option is used to improve interactive latency, it will not make TCP obey message boundaries.</div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Jul 13, 2016 at 11:43 AM Baojun Wang <<a href="mailto:wangbj@gmail.com">wangbj@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Suppose TCP_NODELAY sock opt can prevent Nagle join small packets?</div><br><div class="gmail_quote"></div><div class="gmail_quote"><div dir="ltr">On Wed, Jul 13, 2016 at 11:10 AM Andrey Sverdlichenko <<a href="mailto:blaze@ruddy.ru" target="_blank">blaze@ruddy.ru</a>> wrote:<br></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Wed, Jul 13, 2016 at 3:14 AM Ruben Astudillo <<a href="mailto:ruben.astud@gmail.com" target="_blank">ruben.astud@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Right on the nail. I played a bit with tcpdump/wireshark to see I was<br>
just sending 0 length ACKs and multiple 4 byte messages joined on a<br>
single packet. Seems TCP buffers tiny packets using a strategy called<br>
Nagle's algorithm and thus joined all my packets on a bufferzone until a<br>
threeshold. Then it sent them all at once, making the other end crazy.<br></blockquote><div><br></div></div></div><div dir="ltr"><div dir="ltr"><div class="gmail_quote"><div>This looks a bit scary. It should not matter if replies are merged or not.<br>By any chance, don't your code use recv with some large max buffer size, but expect to get only 4 bytes because this is how much receiver sends each time? If so, change it to read 4 bytes only, and handle the case when less than 4 bytes are out. TCP do not preserve message boundaries and you can expect reads to return data in arbitrary sized chunks.</div><div><br></div><div>Regards,</div><div>  Andrey</div></div></div></div></blockquote></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
_______________________________________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</blockquote></div></blockquote></div>