Updating tcp header
TCP provides reliability with ACK packets and Flow Control using the technique of a Sliding Window.
During the setup of a TCP connection the maximum segment size is determined based on the lowest MTU across the network.
The Send Window size is determined by whatever is the smallest between the Receive Window and the sender's buffer.
When TCP transmits a segment, it places a copy of the data in a retransmission queue and starts a timer.
TCP labels each octet of data with a Sequence Number and a series of octets form a Segment, the sequence number of the first octet in the segment is called the Segment Sequence Number.
The sender can send up to this amount of data before it has to wait for an update on the Receive Window size from the receiver.
The sender has to buffer all its own sent data until it receives ACKs for that data.
Port numbers above 1024 (1024 is reserved) are not regulated, are considered as Unprivileged, or Registered, and these ports are commonly free to be used used by clients talking to Well-Known port numbers. In practice octets are acknowledged in batches, the size of which is determined by the window size (see below).
Applications open port numbers (the TCP/IP model differs from the OSI model in that the Application layer sits straight on top of layer 4) and communicate to each other via these port numbers. The sequence number is a 32-bit binary number, although very large there is a finite number range that is used (0 to 2 If a source host wishes to use an IP application such as active FTP for instance, it selects a port number which is greater than 1023 and connects to the destination station on port 21.