2.28 TCP Packages
Each byte of a TCP stream is numbered, starting with an arbitrary number selected by the sending host. TCP connections are duplex which means that data is transmitted in both directions at the same time. Each host selects an arbitrary starting point for numbering the bytes of its own data stream. The sequence number in the TCP header indicates the number the sending host has assigned to the first byte in the current segment. The numbering starts at an arbitrary number between and and restarts at zero when the highest value has been reached.
The acknowledgement number contains the value of the sequence number which is expected next from the other side. If the acknowledgement does not arrive within a timeout interval, the data is retransmitted. But instead of waiting for acknowledgement of the receipt of every TCP segment before sending the next segment, TCP implementations define a certain number of bytes, the transmission window, the process will send before it expects an acknowledgement from the other host.
The size of the window is determined on the basis of the maximum number of bytes the host at the other side will accept and on the basis of the time it takes to transmit data from the first host to the second and back again, the round trip time (RTT).
Example: The last TCP byte reaching the receiver had the sequence number 30. Thus, the receiver's acknowledgement number will be 31. This value identifies the number of the next byte which is to be sent by the other side. After receiving this acknowledement the sender transmits the next bytes numbered for example 31 to 60. Assuming that the sender does not receive the next acknowledgement with the number 61 within a certain time interval it retransmits the bytes 31-60.