Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

migrated from stackoverflow.com Nov 17 '11 at 23:31

This question came from our site for professional and enthusiast programmers.

closed as not a real question by Chris S, Mark Henderson Nov 18 '11 at 1:58

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

3 Answers 3

up vote 5 down vote accepted

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.

share|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.

share|improve this answer
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

share|improve this answer

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