Transmission Control Protocol (TCP)
One of the main protocols in the TCP/IP suite is Transmission Control Protocol (TCP). This protocol provides reliable and ordered delivery of data between applications running on hosts on a TCP/IP network. Because of its reliable nature, TCP is used by applications that require high reliability, such as FTP, SSH, SMTP, HTTP, etc.
TCP is connection-oriented, which means that, before data are sent, a connection between two hosts must be established. The process used to establish a TCP connection is known as the three-way handshake. After the connection has been established, the data transfer phase begins. After the data is transmitted, the connection is terminated.
One other notable characteristic of TCP is its reliable delivery. TCP uses sequence numbers to identify the order of the bytes sent from each computer so that the data can be reconstructed in order. If any data is lost during the transmission, the sender can retransmit the data.
Because of all of its characteristics, TCP is considered to be complicated and costly in terms of network usage. The TCP header is up to 24 bytes long and consists of the following fields:
source port – the port number of the application on the host sending the data
destination port – the port number of the application on the host receiving the data
sequence number – used to identify each byte of data
acknowledgment number – the next sequence number that the receiver is expecting
header length – the size of the TCP header
reserved – always set to 0
flags – used to set up and terminate a session
window – the window size the sender is willing to accept
checksum – used for error-checking of the header and data
urgent – indicates the offset from the current sequence number, where the segment of non-urgent data begins
options – various TCP options, such as Maximum Segment Size (MSS) or Window Scaling.