Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-users: Re: [Wireshark-users] is it Nagle?

From: "Marco Rommelse" <m.rommelse@xxxxxxxxx>
Date: Fri, 20 Jul 2007 19:39:18 +0200
Hi,

The delay between packet 3 and 4 (0.133 sec.) is due to nagle, as is the
delay between packets 7 and 8 (0.161 sec.). The delays of about 0.30 seconds
between 4 and 5 as well as 0.46 sec. between 8 and 9 are probably not. My
guess would be that this could be caused by program delay.

Nagle is used to keep chattiness under control, an efficiency measure. In
essence it's a sort of timer. Standard for many tcp stacks is that this
timer fires every 200 ms. When the stack has received some data it will wait
sending acknowledgements for data that the program wants to send out. If
that data doesn't come before the timer fires, it will acknowledge the
outstanding data. Now, for telnet for instance this would mean that you will
see a delay between you are typing a character and it being echoed back.
This is why sometimes you want to disable it. 
The following quote I have found for winsock programming:
"The Nagle algorithm is on by default in Winsock, but it can be turned off
on a per-socket basis with the TCP_NODELAY option of setsockopt(). This
option should not be turned off except in a very few situations."

The quote comes from: http://tangentsoft.net/wskfaq/intermediate.html


Marco Rommelse


-----Oorspronkelijk bericht-----
Van: wireshark-users-bounces@xxxxxxxxxxxxx
[mailto:wireshark-users-bounces@xxxxxxxxxxxxx] Namens Omar Balbuena
Verzonden: vrijdag 20 juli 2007 16:42
Aan: wireshark-users@xxxxxxxxxxxxx
Onderwerp: [Wireshark-users] is it Nagle?

Hello!

I have sniffed the communication between a PLC and a software I am 
maintaining. We're introducing TCP/IP communication. There is an 
unexplained, unacceptable delay of about 0,35 seconds between every ACK 
and SEND here. See messages 4 and 5, or 8 and 9:
http://balbuena.com.br/aae/2007/undesired-delay.pcap
http://balbuena.com.br/aae/2007/undesired-delay.png

I am absolutely sure this has nothing to do with software processing, 
because such thing never happened with serial ports and modem 
communication using the exact same layers. After some research, I've 
discovered it seems to be the Nagle Algorithm that's slowing me down, 
and I've added the proper lines of code and it seems to have no effect. 
But this looks like absolutely anything but Delayed Ack.

My question is:
Is it really Nagle?
If it is, do any of you have any example of some complete Winsock2 
application that manages to disable it?
If it's not, what is it and how do I disable it in Winsock2?
How could I switch to Delayed Ack using Winsock2?
*OR* Is there a better alternative than Winsock2 for developing a TCP/IP 
layer for a small message protocol into a Windows C++ non-MFC DLL?

-- 
Omar M. Balbuena N.
Canopus Informática Ltda
Porto Alegre - RS - Brasil
+55 51 33622404
http://www.canopusonline.com/

_______________________________________________
Wireshark-users mailing list
Wireshark-users@xxxxxxxxxxxxx
http://www.wireshark.org/mailman/listinfo/wireshark-users