Read the original speed -TCP / IP (TCP normal data flow)

Bulk data stream Chapter 20 TCP

20.2 normal data stream

We start with one-way transmission from the host svr 4 8,192 bytes to the host bsdi. Running sock program on bsdi as a server:

bsdi % sock -i -s 7777

Wherein the flag - i and - s instructions of the program as an "absorbent (sink)" server is running (read and discard the data from the network), designated as the server port 7777. The appropriate client program runs as follows:

svr4 % sock -i -n8 bsdi 7777

This command instructs the client 8 transmits 1024 bytes of data to the network. FIG 20--1 shows the time series of the process. We show the values ​​at each end of the MSS in the first three segments of the output.

First, the sender transmits three data segments (4-6). The next packet segment (7) confirmed that only the first two data segments, which may be 2048 rather than 3073 seen from the acknowledgment number.

The ACK segment No. 7 reason is 2048 instead of 3073 was caused by the following reasons: When a packet arrives, it is first interrupt routine for processing the device, and then placed into the input IP queue. Three segments 4, 5 and 6 into the order of reception are sequentially press reaches the IP input queue. IP will be the same order they were handed over TCP. 4 when the connection is marked to generate a TCP segment is subjected to the processing delay of acknowledgment. TCP process the next segment (5), since there are now two TCP unfinished segment acknowledgment is required, thus producing a sequence number of the ACK 2 0 4 8 (segment 7), and clears the connection is subjected is generated confirmation flag delay. A next TCP packet processing section (6), connected to produce a flag has been subjected acknowledgment delay. Before the arrival of segment 9, since the delay timer expires, thus creating a sequence number of the ACK 3 0 7 3 (segment 8).

Window size of 8 segments is 3072, indicating that there is TCP receive buffer 1024 bytes of data waiting to be read by the application. Segments 11 to 16 illustrate "a spacer segment acknowledgment message" strategy commonly used. 11,1 segments 2 and 13 and reaches into the receive queue IP. When segment 11 is processed, the connection is marked as an acknowledge subjected to a delay. When the segment 12 to be treated, their ACK (segment 14) is generated and subjected to the delay of the connection confirmation flag is cleared. Message
segment 13 is connected again so as to produce labeled subjected delay. However, before the delay timer expires, segment 15 is processed, so that the confirmation is sent immediately.
Here Insert Picture Description
It noted that the segment of the ACK 7,1 4 and 16 confirmed the receipt of two segments is very important. When using TCP sliding window protocol, the receiver does not have to confirm each received packet. In TCP, ACK is cumulative - which represents the receiver has correctly received all the bytes until the acknowledgment number minus 1. In the present embodiment, the three confirmation data 2048 bytes of data is confirmed two 1024-byte (ignoring the acknowledgment of connection establishment and termination). With tcpdump see the dynamic activities of TCP. We see the line of packet order is dependent on many factors beyond its control: realize the TCP sender, recipient achieve TCP, the receiving process reads data (depending on the operating system scheduler) and dynamic network (such as Ethernet and avoidance of conflict, etc.). TCP these two terms, no single,
correct way to exchange a given amount of data.

How to display the situation may change, FIG. 2 0 - 2 shows another series of time when the same data exchange between the same two hosts, they are in FIG. 2 0 - intercepted after several minutes shown.

Some things have changed. This time, the receiver does not transmit a sequence number of the ACK 3 0 7 3, but waits for the send sequence number and ACK 4 0 9 7 a. Transmitting only the receiving side four ACK (segment 2 7,1 0,1 and 15): to confirm the three-byte 2048, another was confirmed 1,024 bytes. ACK last 1024 bytes of data occurs in the 1 to 7, it transmits an ACK to the FIN segment (compare the figure with the segment 17 of FIG 2 0 - segments of 116 and 18).
Here Insert Picture Description
Fast sender and recipient slow FIG 20--3 shows another time series. This is a fast sender from (S parc a workstation) to a slow receiver (with 80386 machines slow Ethernet card). Its dynamic activities are different.

4 sender sends back to back (back - to - back) of the data segment to fill the receiver window, and then stop and wait for an ACK. Receiver sends ACK (segment 8), but its advertised window size is 0, indicating that the receiver has received all data, but the data in TCP buffer receiving side, because the application has no chance to read the data. Another ACK (referred to as a window update) transmitted after 17.4 ms, indicating that the receiver can now receive additional 4096 bytes of data. Although this seems like a the ACK, but since it does not acknowledge any new data, but to increase the window along the right side, it is called to update the window.

The sender sends the last four segments (10 ~ 13), refilling the receiving side window. Noting segment 13 includes two bit flags: PUSH and FIN. Coming from the receiving side then the other two ACK, which confirmed the final 4096 bytes of data (from 4,097 to 8,192 bytes) and the FIN (numbered 8192)
Here Insert Picture Description

Released 1531 original articles · won praise 1468 · Views 130,000 +

Guess you like

Origin blog.csdn.net/weixin_42528266/article/details/104773273