Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to know what kind of information is passed to my network adapter when I hooked on the network with my PC.

What will the operating system do with the received packets. How do they interpret them? Some packets are destined for some applications such as ftp or an online game. How does the operating system know how to pass on the packets ?

I know the basics about the TCP/IP stack. But those are theory, I can not relate the "reality" with the theory.

share|improve this question

closed as not a real question by slhck, sblair, Simon Sheehan, David Schwartz, tombull89 Mar 6 '12 at 22:04

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.

Are you asking for a simple explaination on how the data is directed to the various programs? – Psycogeek Mar 6 '12 at 21:25
Your question is extremely broad. Right now it would take the entire content of several Network Programming books, and Network Design books to fully 'answer' this. – Zoredache Mar 6 '12 at 23:12
If this question was edited to ask something specific instead of a fuzzy "I'm bewildered" question, it could be reopened. As human beings seem to be able to use computers without knowing anything about how networks work, this question makes me wonder; Why do you care? And if you care, why not just read a big fat book? You either know how TCPIP works, and DHCP and all that, or you don't. My guess is you absorbed 3% of the material but you need a new book. – Warren P Mar 7 '12 at 2:45
i know it's vague. but as i mentioned, it's hard to relate theory with practice. i dont know any book that offers hands on lab exercises so it's difficult for self learners – osager Mar 7 '12 at 12:28
up vote 3 down vote accepted

Your questions is quite vague, so it's hard to provide "the answer". If you want to learn TCP/IP as a programmer here is what's considered "The Textbook" on it:

here is another introduction to the topic:

to answer the part "how does the OS know what to do with incoming packets?" (I oversimplify)

Incoming packets are either new, or belong to an existing communication. Let's look at "new" packets: they go to a destination port (like an incoming FTP connection goes to 21/tcp - look for more "default" destinations in /etc/services). The OS hands off anything for that port to a local application that "listens" on that port (here, the FTP daemon - look at who listens where with netstat -a ). If the application answers appropiately, a "conversation" is started.

Extension to the question in the comment: where is the port number encoded? The source and destination port numbers are in the first octet of the TCP segment header, which is usually transmitted as IP datagrams, which are usually sent around as payload of ethernet frames, on an ethernet.

share|improve this answer
@slhck: This question is so open-ended and vague that a specific answer really isn't possible. – David Schwartz Mar 6 '12 at 21:22
I agree with the first part, but then it shouldn't be answered in the first place, but flagged or voted to be closed. @david – slhck Mar 6 '12 at 21:24
hi thanks for this explanation on packet routing. the packets are in fact ones and zeros. how do they encode the port number part ? – osager Mar 7 '12 at 12:27
@osager - try to get away from talking about "packets". That is a very misleading term in this context. – Florenz Kley Mar 7 '12 at 12:43
@osager - why not use the specific terms defined in the RFCs and other documentation. That would make it easier on you and everyone else. Of you course you earn a reputation as beeing sticklish that way, but that's a fact of life when you dive deeper into a topic. – Florenz Kley Mar 7 '12 at 13:34

Steve Gibson and Leo Laporte put out a podcast called "Security Now!" they did a series on "How the internet works", it should go over the topics you want to know in detail.

I will link the episodes directly talking about the topic but I do recommend going and listening to the other episodes in between the ones I listed (especially the Q&A episodes following each linked ep.)

share|improve this answer

In a nutshell, the network stack of which TCP is part of is made up of many layers. This is called the OSI network model.

The control of what data goes to where I believe is at layer 4.

Which application sees what data in TCP/IP is based on the port number which I hope you are familiar with from reading about TCP/IP. But if not, every connection has a port which is a bit like a set of post office mail boxes. Those mailboxes are located at an address, and each one is numbered. Similarly, the computer can have an IP address (like a physical address), and the mailbox numbers correspond to the port numbers.

Software at layer 4 will put the data packets into the correct places like a mail man puts the mail into the correct boxes.

Interpretation of the packets happens at different layers of the OSI model. For example, TCP is actually a protocol built on top of IP. IP is implemented at the network layer (4). While TCP is at the (higher level) session layer 5. TCP is actually built on top of IP. The same is true for UDP. UDP is built on top of IP.

At the very top of the OSI model is the application layer. This is where applications like FTP etc will reside.

That's a very quick summary but I hope it helps.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged .