Interactive Data Exchange

Figure 7.39 shows a simple TCP session between an Echo client and server. The Echo client on Arachnid connects to the Echo server on Greywolf, sends the characters “t,” “e,” “s,” and “t,” and then disconnects.

Echo is a simple application that takes characters from a client and then echoes the characters back. As such, Echo is a good example of how TCP handles interactive applications that send and receive many small segments.

An Echo client exchanging data with an Echo server
Figure 7.39. An Echo client exchanging data with an Echo server

The order of events are as follows:

  1. [Segments 0-2] The Echo client on Arachnid allocates a TCP client port (4868), and establishes a TCP connection with the Echo server’s well-known port (TCP port 7) on Greywolf.

  2. [3] The Echo client sends the letter “t” (hex 74). In addition, notice that the Sequence Identifier of this segment has been incremented by one (now being set at 138,921) allowing data that is sent after the circuit has been established to be tracked separately from the segments used to establish the connection. Also, notice that the Push flag is set on this segment, indicating that the application requested that TCP clear the send buffer immediately, an act that also forces the recipient to clear its receive buffer immediately as well. For more information on the Push function, refer to Section 7.1.5.5.

  3. [4] Greywolf’s Echo server responds to the segment by returning ...

Get Internet Core Protocols: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.