What exactly does the Nagle algorithm do?


What exactly does the Nagle algorithm do?

  It groups together as much data as it can between ACK's from the other
  end of the connection.  I found this really confusing until Andrew
  Gierth (andrew@erlenstar.demon.co.uk) drew the following diagram, and
  explained:

  This diagram is not intended to be complete, just to illustrate the
  point better...

  Case 1: client writes 1 byte per write() call. The program on host B
  is tcpserver.c from the FAQ examples.

        CLIENT                                  SERVER
  APP             TCP                     TCP             APP
                  [connection setup omitted]