I know that this question sounds stupid, but over all these years, I still have difficulty explaining TCP/IP to people. I don't completely get it myself, and even after reading up on it, the distinction is not very clear. What I get so far is that IP deals with networks while TCP involves delivery of messages over that network. I'm not totally convinced though. Also, they reside on different layers of the Internet architecture. Could anyone disambiguate this distinction using a simple analogy or examples? Also, I read this somewhere

The difference is that TCP is responsible for the data delivery of a packet and IP is responsible for the logical addressing. In other words, IP obtains the address and TCP guarantees delivery of data to that address.

Is this correct? Thanks for helping me out. One last thing- Where does the ethernet come in all of this?


Consider an analogy. You run a spy network. The spies all communicate with headquarters (you) using carrier pigeons. They send messages to you and you send messages back.

Problem: sometimes the messages don't arrive, or they arrive out-of-order. The birds get delayed, they stop to eat, sometimes a cat gets one.

That's IP. It sends packets and hopes they get there.

This is unsatisfactory, of course. So you arrange with your spies to put some extra information on each message: the time they sent it, the time they sent the previous message, a consecutive number. Also, if the recipient doesn't acknowledge the message within a certain time, they should re-send it. Now you can tell if anything's missing or out of order.

That's TCP. It uses an unreliable protocol (IP) to produce a reliable connection.

| improve this answer | |
  • thanks tom. but then why is UDP required if IP is already present? – OckhamsRazor Sep 18 '11 at 18:49
  • because IP is about routing, while UDP is about messages. The tasks and levels of abstraction are different – ftartaggia Sep 18 '11 at 22:59
  • IP itself only allows you to get a packet to a machine. UDP multiplexes and de-multiplexes different endpoints on the same machine (as does TCP). UDP and IP provide the same kind of service, just at different levels. – David Schwartz Nov 18 '11 at 1:03

Analogies are like vacuums, they suck.

The OSI model was invented to describe the different roles each layer of networks stacks serves. Each layer is fairly small and relatively easy to understand. IP doesn't follow the model precisely, but it's still somewhat close.

Ethernet - starting at the bottom layer, Ethernet is the wire protocol that allows computers to use; it generally involves itself in the details of the physical connection and how it the computer actually shovels data over the wires plugged into the back of your computer.

IP since Ethernet already has the physical details taken care of, the next logical thing that needs tending to are the most generic logical details. IP basically takes care of the logical addressing and intranetwork concepts (the collection of computers "on your network"). Consequently, computer that aren't on your network are automatically on some other network, and there are rules as to how IP gets traffic off your network to another.

TCP and UDP these are just two of the most popular protocols at this layer, there are many others and people are generally less familiar with them. TCP is the lowest layer that keeps track of connections; like when you connect to a web server to request a webpage. UDP is a similar protocol, but explicitly does not keep track of connections. This makes UDP "lighter" and simpler, if you just need to send a single message this makes more sense, similarly if you need to minimize data send (like online video games).

HTTP, DNS, etc Built on the previous layers are the actual application protocols. As you probably know, there's literally millions of them out there. These define the data structures that are sent across the network and allow different programs to "speak the same language".

SSL and IPSec There are other protocols which actually situate themselves inbetween other layers. SSL sits between TCP and HTTP for instance to produce HTTPS; the same communication but with encryption (generally). IPSec is a different security protocol that sits between IP and TCP, it works somewhat differently from SSL, but generically provides some of the same protections.

| improve this answer | |
  • 1
    Disagree with your first sentence. Analogies are great. And my vacuum cleaner at home, a Dyson, it kicks ass - actually makes me want to do housework. So sucking isn't always a bad thing. Unless you find yourself in the unfortunate situation of actually being in a vacuum. Then they're not so much fun. – Mark Henderson Nov 18 '11 at 1:59
  • @MarkHenderson Well you have a bit of a point. I've got a Dyson Ball, definitely the nicest vacuum I've ever had. I'm disappointed you didn't point out the irony of my statement though. – Chris S Nov 18 '11 at 2:53
  • the rest was tl;dr – Mark Henderson Nov 18 '11 at 4:40

to keep it as simple as possible, IP protocol answers the question "how do I send a message from computer A to computer B"? It is more or less the same task of a car navigation system.

TCP, on the other hand, answers the question "how do I send a message from application X on computer A to application Y on computer B so that I can be sure my message is received correctly?"

IP is like mail delivery service. Say you want to send 2 big gifts to your friend by mail: the gifts are too big to fit in one package, so your post office asks you to prepare 2 different boxes, one for each present. They then send each box separately: they will try to find the path to your friend's house, but you can't know which box will arrive first, and sometimes some box goes lost.

TCP, instead, is like telephone service: once the communication between you and your recipient is established, your words are delivered to the other person in the same order you said them. If you speak to quickly your friend will ask you to repeat the last sentence, more slowly. TCP does all this for your byte streams.

TCP breaks your messages into little pieces and asks IP to deliver them to the right destination: once they arrive, TCP makes sure every piece is in the right position to form back the original message

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.