TCP – Reliable Byte Stream

TCP is a moresophisticated transport protocol is one that offers a reliable, connection oriented byte stream service. Such a service has proven useful to a wide assortment of application because it frees the application from having to worry about missing or reordered data.


TCP is a moresophisticated transport  protocol  is one that offers a reliable, connection oriented byte stream service. Such a service has proven useful to a wide assortment of application because it frees the application from having to worry about missing or reordered data.

 TCP guarantees the reliable in order delivery of a stream of bytes. It is a full duplex protocol meaning that each TCP connection supports a pair of byte streams, one flowing each direction. It also includes a flow control mechanism for each of these byte streams that allow the receiver to limit how much data the sender can transmit at a given time.

 Finally, like UDP, TCP supports a demultiplexing mechanism that allows multiple application programs on any given host to simultaneously carry on a conversation with their peers. In addition    to   the     above   features,  TCP  also implements a highly tuned  congestion control mechanism.


 At the heart of TCP is sliding window algorithm. TCP supports logical connections between processes that are running on any two computers in the internet. This means that TCP needs an explicit connection establishment phase during which the two sides of the connection agree to exchange data with each other. This difference is analogous to having a dedicated phone line. TCP also has an explicit connection teardown phase.

 One of the things that happen during connection establishment is that the two parties establish some shared state to enable the sliding window algorithm to begin. Connection teardown is needed so each host known it is OK to free this state.

 Whereas, a single physical link that always connects the same two computers has a fixed RTT, TCP connection are likely to have widely different round trip times.

 Variations in the RTT are even possible during a single TCP connection. Packets may be reordered as they cross the internet, but this is not possible on a point-to-point link where the first packet put into one end of the link must be the first to appear at the other end. Packets that are slightly out of order don‟t cause a problem since the sliding window algorithm can reorder packets correctly using the sequence number.

 TCP assumes that each packet has a maximum lifetime. The exact lifetime, known as the maximum segment lifetime (MSL), is an engineering choice. The current recommended setting is 120seconds.

 The computers connected to a point to point link are generally engineered to support the link. For example, if a link‟s delay X bandwidth product is computed to be 8KB –meaning that a window size is selected to allow up to 8kb of data to be unacknowledgement at a given time then it is likely that the computers at either end of the link have the ability to buffer up to 8kb of data.

 Because the transmitting side of a directly connected link cannot send any faster than the bandwidth of the link allows, and only one host is pumping data into the link, it is not possible to unknowingly congest the link. Said another way, the load on the link is visible in the form of a queue of packets at the sender. In contrast, the sending side of a TCP connection has no idea what links will be traversed to reach the destination.


TCP is a byte oriented protocol, which means that the sender writes bytes into a TCP connection and the receiver reads bytes out of the TCP connection. Although “byte stream” describes the service TCP offers to application processes, TCP does not itself transmit individual bytes over the internet. Instead, TCP on the source host buffers enough bytes from the sending process to fill a reasonably sized packet and then sends this packet to its peer on the destination host. TCP on the destination host then empties the contents of the packet into a receiving process reads from this buffer at its leisure.

The packets exchanged between TCP peers are called segments, since each one carries a segment of the byte stream. The SrcPort and Distorts fields identify the source and destination ports, respectively, just as in UDP. These two fields, plus the source and destination IP addresses, combine to uniquely identify each TCP connection. That is, TCP‟s demux key is given by the 4-tuple

(SrcPort, SrclPAddr, DstPort, DstlPAddr)

 The acknowledgement, sequence num and advertised window fields are all involved in TCP‟s sliding window algorithm. Because TCP is a byte oriented protocol, each byte of data has a sequence number, the sequence num field contains the sequence

 number for the first byte of data carried in that segment. The acknowledgement and advertisement window values flowing in the opposite direction.

The 6-bit flags field is used to relay control information between TCP peers. The possible flags include SYN, FIN, RESET, PUSH, URG, and ACK. The SYN and FIN flags are used when establishing and terminating a TCP connection, respectively. The ACK flag is set any time the Acknowledgement field is valid, implying that the receiver should pay attention to it. The URG flag signifies that this segment contains urgent data. When this flag is set, the UrgPtr bytes into the segment. The PUSH flag signifies that the sender invoked the push operation which indicates to the receiving side of TCP that it should notify the receiving process of this fact.

 The RESET flag signifies that the receiver has become confused for example, because it received a segment it did not except to receive and so wants to abort the connection.

Related Posts

Comments are closed.

© 2023 Software Engineering - Theme by WPEnjoy · Powered by WordPress