top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is TCP and how does it work?

+2 votes
487 views

Internet Protocol, or IP, provides an unreliable packet delivery system--each packet is an individual, and is handled separately. Packets can arrive out of order or not at all. The recipient does not acknowledge them, so the sender does not know that the transmission was successful. There are no provisions for flow control--packets can be received faster than they can be used. And packet size is limited.

Transmission Control Protocol (TCP) is a network protocol designed to address these problems. TCP uses IP, but adds a layer of control on top. TCP packets are lost occasionally, just like IP packets. The difference is that the TCP protocol takes care of requesting retransmits to ensure that all packets reach their destination, and tracks packet sequence numbers to be sure that they are delivered in the correct order. While IP packets are independent, with TCP we can use streams along with the standard Java file I/O mechanism.

Think of TCP as establishing a connection between the two endpoints. Negotiation is performed to establish a "socket", and the socket remains open throughout the duration of the communications. The recipient acknowledges each packet, and packet retransmissions are performed by the protocol if packets are missed or arrive out of order. In this way TCP can allow an application to send as much data as it desires and not be subject to the IP packet size limit..
TCP is responsible for breaking the data into packets, buffering the data, resending lost or out of order packets, acknowledging receipt, and controlling rate of data flow by telling the sender to speed up or slow down so that the application never receives more than it can handle.

There are four distinct elements that make a TCP connection unique:

  • IP address of the server
  • IP address of the client
  • Port number of the server
  • Port number of the client
    Each requested client socket is assigned a unique port number while the server port number is always the same. If any of these numbers is different, the socket is different. A server can thus listen to one and only one port, and talk to multiple clients at the same time.

So a TCP connection is somewhat like a telephone connection; you need to know not only the phone number (IP address), but because the phone may be shared by many people at that location, you also need the name or extension of the user you want to talk to at the other end (port number). The analogy can be taken a little further. If you don't hear what the other person has said, a simple request ("What?") will prompt the other end to resend or repeat the phrase, and the connection remains open until someone hangs up.

posted Aug 13, 2014 by Vrije Mani Upadhyay

  Promote This Article
Facebook Share Button Twitter Share Button LinkedIn Share Button


Related Articles

TCP/IP Encapsulation

When data moves from upper layer to lower level of TCP/IP protocol stack (outgoing transmission) each layer includes a bundle of relevant information called a header along with the actual data. The data package containing the header and the data from the upper layer then becomes the data that is repackaged at the next lower level with lower layer's header. Header is the supplemental data placed at the beginning of a block of data when it is transmitted. This supplemental data is used at the receiving side to extract the data from the encapsulated data packet. This packing of data at each layer is known as data encapsulation.
enter image description here

Figure ofTCP/IP Encapsulation

TCP/IP Decapsulation

The reverse process of encapsulation (or decapsulation) occurs when data is received on the destination computer. As the data moves up from the lower layer to the upper layer of TCP/IP protocol stack (incoming transmission), each layer unpacks the corresponding header and uses the information contained in the header to deliver the packet to the exact network application waiting for the data.
enter image description here

Figure of TCP/IP Decapsulation

Names of different network data packets
The format of the data packet generated at different layers is different, and known by different names.
The data packet created at the Application layer is known as a "MESSAGE".
As described in the previous lesson, the Transport Layer contains two important protocols: TCP (Transmission Control Protocol) and UDP (User Datagram Protocol). TCP (Transmission Control Protocol) is more reliable but consumes more resource. UDP (User Datagram Protocol) is less reliable but consume fewer resources than TCP (Transmission Control Protocol) and is faster than TCP (Transmission Control Protocol).

The Application layer message is again encapsulated at the Transport Layer. If the protocol used at the Transport Layer is TCP (Transmission Control Protocol), the data packet is known as a "TCP SEGMENT". If the protocol used at the Transport layer is UDP (User Datagram Protocol), the data packet is known as a "UDP DATAGRAM".

The data packet created at the Internet layer by Internet Protocol, which again encapsulates the Transport layer segment/datagram, is known as a "IP DATAGRAM".

The data packet at the Network Access layer, which encapsulates and may subdivide the IP Datagram, is known as a "FRAME" (generally Ethernet Frame). The Frame is converted into a bitstream at the lowest sublayer of the Network Access layer and then placed on medium.

READ MORE
...