Latest Job News

Transmission Control Protocol (TCP) Services 

 

 

The second transport layer protocol is called Transmission Control Protocol (TCP). TCP, like UDP, is a process-to-process (program-to-program) protocol. TCP, therefore, like UDP, uses port numbers. Unlike UDP, TCP is a connection oriented protocol; it creates a virtual connection between two TCPs to send data. In addition, TCP uses flow and error control mechanisms at the transport level.

TCP Services:

The services offered by TCP to the processes at the application layer are as follows:

Process-to-Process Communication:

TCP provides process-to-process communication using port numbers. The following table lists some well-known port numbers used by TCP.

 

tcp services_port numbers

 


Stream Delivery Service:

TCP, unlike UDP, is a stream-oriented protocol. TCP, on the other hand, allows the sending process to deliver data as a stream of bytes and allows the receiving process to obtain data as a stream of bytes. TCP creates an environment in which the two processes seem to be connected by an imaginary "tube" that carries their data across the Internet. This imaginary environment is depicted in the following figure. The sending process produces (writes to) the stream of bytes, and the receiving process consumes (reads from) them.

 

Process-to-Process Delivery Concepts
User Datagram Protocol (UDP)
TCP Segment
How To Create a TCP Connection?

 

tcp services_stream Delivery

 

Sending and Receiving Buffers:

 

Because the sending and the receiving processes may not write or read data at the same speed, TCP needs buffers for storage. There are two buffers, the sending buffer and the receiving buffer, one for each direction and these buffers are also necessary for flow and error control mechanisms used by TCP.) One way to implement a buffer is to use a circular array of 1-byte locations as shown in the following figure.

 

tcp services_stream Delivery Buffer

 

The above figure shows the movement of the data in one direction.

At the sending site, the buffer has three types of chambers. The white section contains empty chambers that can be filled by the sending process (producer). The gray area holds bytes that have been sent but not yet acknowledged. TCP keeps these bytes in the buffer until it receives an acknowledgment. The colored area contains bytes to be sent by the sending TCP. However, TCP may be able to send only part of this colored section. This could be due to the slowness of the receiving process or perhaps to congestion in the network. Also note that after the bytes in the gray chambers are acknowledged, the chambers are recycled and available for use by the sending process. This is why we show a circular buffer.

At the receiving site, the operation of the buffer at the receiver site is simpler. The circular buffer is divided into two areas (shown as white and colored). The white area contains empty chambers to be filled by bytes received from the network. The colored sections contain received bytes that can be read by the receiving process. When a byte is read by the receiving process, the chamber is recycled and added to the pool of empty chambers.

Segments: 

 

The buffering handles the disparity between the speed of the producing and consuming processes, we need one more step before we can send data. The IP layer, as a service provider for TCP, needs to send data in packets, not as a stream of bytes. At the transport layer, TCP groups a number of bytes together into a packet called a segment. TCP adds a header to each segment (for control purposes) and delivers the segment to the IP layer for transmission.

The segments are encapsulated in IP datagrams and transmitted. This entire operation is transparent to the receiving process. The segments may be received out of order, lost, or corrupted and resent. All these are handled by TCP with the receiving process unaware of any activities. The following figure shows how segments are created from the bytes in the buffers.

 

tcp services_segments

 

Full-Duplex Communication:


TCP offers full-duplex service, in which data can flow in both directions at the same time. Each TCP then has a sending and receiving buffer, and segments move in both directions. Connection-Oriented Service:
TCP, unlike UDP, is a connection-oriented protocol. When a process at site A wants to send and receive data from another process at site B, the following occurs:

 

1. The two TCPs establish a connection between them.

2. Data are exchanged in both directions.

3. The connection is terminated.

The TCP segment is encapsulated in an IP datagram and can be sent out of order, or lost, or corrupted, and then resent. Each may use a different path to reach the destination. There is no physical connection. TCP creates a stream-oriented environment in which it accepts the responsibility of delivering the bytes in order to the other site.

Reliable Service

TCP is a reliable transport protocol. It uses an acknowledgment mechanism to check the safe and sound arrival of data. We will discuss this feature further in the section on error control.

 

 

For Further Reading:  

Flow Control in TCP 

Error Control in TCP

Back to DCN Questions and Answers