Saturday, September 11, 2010

WHAT IS A PROTOCOL? (Focus on TCP/IP)

Hi everyone

I was trying to understand the meaning of 'protocol' and the use of TCP/IP with the help of our all-time friend Google. I thought I would write in a blog about the same to save my friends' time searching!

(Just as for most of us, this is my first blog too!)

From all my search on Google, I gathered that:

A protocol is a formal description of message formats and the rules that two or more machines must follow to exchange those messages.

For instance, if two people A & B want to communicate. Imagine the confusion and chaos if they start talking simultaneously. To avoid it, they must follow a set of rules while talking, as to who talks first and for how long etc. This common set of rules would be known as communication protocol for A & B.

Now, there are various protocols used in various types of networks.
TCP/IP is the native protocol of Internet.

These are two separate protocols.
-> TCP (Transmission Control Protocol) deals with the construction of data packets.
(A packet is a sequence of bytes and consists of a header and a body. The header describes the packet's destination and the body contains the data being transmitted.)
->IP routes them from machine to machine.

More technically, TCP provides the service of exchanging data reliably between two network hosts; on the other hand, IP handles addressing and routing messages across one or more networks.
So basically, TCP provides a communication service at an intermediate level between an application program and the Internet Protocol (IP).

-> Basic function of TCP

That is, when an application program desires to send a large chunk of data across the internet using IP, the data has to be broken into IP-sized pieces and then a series of IP requests have to be issued. Here, TCP comes to the rescue. Instead of issuing several requests, the software can issue a single request to TCP and let TCP handle the IP details.

-> Error detection during transfer of data packets

Now, due to network congestion or other unpredictable network behaviour, IP packets can be lost, duplicated or delivered out of order. TCP detects these problems, requests retransmission of lost packets, rearranges out of order packets and even helps reduce network congestion. Once the TCP receiver has finally reassembled a perfect copy of the original message, it passes it to the application program.

Thus, the basic function of the TCP layer is to abstract (recall the concept of Data hiding and abstraction we have studied in programming :D) application's communication from the underlying network details.

->TCP: Accurate delivery rather than timely delivery

TCP guarantees accurate delivery of a data stream from one host to another, i.e., without duplication or loss of data. But it does incur relatively long time delays, for example, while waiting for retransmission of lost messages.
Thus, though it ensures delivery of complete messages, it is not particularly suitable for real-time applications such as Voice over IP. (There are other protocols for such applications, like RTP - Real Transfer Protocol)

AT A GLANCE:

Suppose an HTML file has to transferred across the web. The TCP divides the data into segments and then, forwards them individually to the IP layer. Now, this layer encapsulates each segment into an IP packet, and adds a header containing the destination IP address. Note that even though each packet has the same destination address, they can be routed on different paths through the network. When the segments reach the destination computer, the TCP layer reassembles them and ensures that they are correctly ordered and error free, before streaming them into an application.

I hope this post will help you all!

Any suggestions and comments are always welcome! :)

7 comments:

  1. Nice post. Just to add, however, RTP is not a replacement for TCP. TCP works on layer four (transport layer), whereas RTP is a layer seven (application layer) protocol. The replacement for TCP would be UDP (another widely used layer four protocol), which is used by most of the real-time streaming protocols at the lower layers.

    ReplyDelete
  2. @rhea, very well written.
    @arjun, Rhea never said RTP as the replacement for TCP. she just said that for applications like Voice over IP, RTP is more suitable. But, i agree with you that best replacement for TCP would be UDP

    ReplyDelete
  3. Praneet: If you're talking about about TCP and then you state that "it is not particularly suitable for real-time applications such as Voice over IP. (There are other protocols for such applications, like RTP - Real Transfer Protocol)", it certainly does sound as if you're suggesting that it's a replacement.

    ReplyDelete
  4. Okay guys!
    I will take care of these ambiguous statements in future!

    ReplyDelete
  5. This is my first visit to your web journal! We are a group of volunteers and new activities in the same specialty. Website gave us helpful data to work. 192 168 0 1

    ReplyDelete
  6. Effective Bitcoin Marketing regularly results from creative organizations essentially tolerating installments to open up new specialties. Numerous organizations have had incredible fortunes with utilizing Bitcoin, which further fortifies the economy by giving more uses for the cryptocurrency. bitcoin mixer

    ReplyDelete