munications 12345678 12345678 12345678 12345678 Source port Destination port Sequence number Acknowledgment number Reserved UAPRSF RCSSYI Window offset 000000 GKHTNN Checksum Urgent pointer Options Padding Figure 6.48 TCP header. PSH is set if data should be forwarded immediately to application process, no more segment is waiting. RST is set when the TCP connection is not accepted or to terminate a connection when a problem has occurred. SYN is used in connection establishment for synchronization of sequence numbering FIN indicates that this is the last data segment and there is no more to transmit. The window indicates the number of bytes allowed to be sent by the other party without acknowledgment starting from the value given in the acknowledgment number field. The checksum is calculated over the entire TCP segment, header and data, and it is used for error detection. If the URG control bit is set urgent pointer tells the offset of urgent data relative to the current sequence number. The most important use for the options field is to indicate at the far end the maximum segment length that the host can han- dle. All Internet hosts are required to accept TCP segments of 536 + 20 = 556 bytes. Maximum segment size can be different in different directions. 6.6.9.2 TCP Connection Management For establishment of a TCP connection, three-way handshaking, as shown in Figure 6.49, is carried out. A server that accepts TCP connection requests has Introduction to Telecommunications Network Engineering Host 1, client Host 2, server Requests Listens TCP connection, sends SYN Connection request to the port SEQ=200, CTL=SYN Receives SYN, accepts connection, sends SYN where Receives SYN, Connection confirm SEQ=400, ACK=200+1 connection ACK=201, CTL=SYN,ACK established, sends data where SEQ=200+1 Data SEQ=201, Receives first data, ACK=400+1 ACK=401, CTL=ACK connection established, sends data where SEQ=400+1 Receives data, Data SEQ=401, ACK=201+1 sends data where ACK=202, CTL=ACK SEQ=201+1 ACK=401+1 Figure 6.49 TCP connection est