In this article, I’d like to explain, in layman terms, how computer networking works, in particular TCP/IP — the protocol that’s used on the internet. It will cover internet addressing, domain names, and ports. Hopefully by the end of reading this article, you’ll be able to understand better about how information transfers among computers. On page 1, I’ll talk about the basics of computer network. On page 2, I’ll talk about domain names and On page 3, I’ll talk about ports.
The basics of Computer Network (it’s a post office, really)
Ok so here’s the problem. I have this information (be it in a file, or something you type or any other) that I need to send from computer A to computer B. How do I do that?
The best analogy, I think, is if you think of exchanging information between 2 computers as regular postal mail service. For example, in postal mail service, Henry (computer A) have a letter or document (a file in computer) that he wants to send to John (computer B). What Henry does, then, is to put the letter in an envelope and drop it in at a post office and in turn, post office will deliver it to John.
Suppose that the letter is 30 pages long, and for some reasons, the only available envelope can only fit 1 page. What to do? Well, since having bigger envelope is not an option, the next best thing is to have 30 envelopes, one for each page, and send the mail 30 times. Now, as far as post office concerns, those 30 envelopes are just mail to be delivered to John. Also, when John receives it, there’s no guarantee that he’ll receive the mail in the order it was sent. So then we have to identify on the envelope that it contains page 1 of 30, page 2 of 30 and so on. Therefore, when John receives it, he can reassemble the letter in the correct order.
How is it in computer network
Almost exactly the same thing happens in computer networking. You have a file that you need to send, it is then broken into smaller chunks, put an envelope on it and send it to your gateway / ISP. Just like a regular mail, the envelope contains the address where the recipient should be as well as the sequence number. The envelope along with the data that is ready to be sent is called a datagram.
User Datagram Protocol (UDP)
To relate back to our example above, Henry would have to send 30 packets and John will receive 30 datagrams. John will know the order of the envelopes and all he has to do is to open the envelope and put the letter inside it in the same order as marked on the envelope. Similarly, the recipient computer will get all 30 datagrams and it will be able to reconstruct the file correctly.
The methodology that I’ve explained to you above is called User Datagram Protocol or UDP. For more technical information about UDP, there’s a good explanation about it on Wikipedia site here.
Well, now that you understand UDP and the analogy of sending regular mail through post office, you can see that there’s a potential issue in the implementation. Let’s suppose that in the example above, John receives all, but envelope number 23. He can then tell Henry to re-send envelope 23, but then how would John know when to request? It is possible that as soon as John sends request to re-send envelope 23, the post office delivers the missing envelope 23. Tons of reasons why envelope 23 may be delayed. It could be that the mail man was sick so he’s not delivering on that day, or could be anything.
So we need a better way to make sure that John receives all the data properly. Fortunately, in computer networking, UDP is not the only protocol to send data among computers.
Transmission Control Protocol (TCP)
In UDP, one can send a packet at will (sort of speak). Henry, for example, can send mail to John without John expecting it. And once Henry sends the mail, he’ll just have to assume that it is delivered, unless John comes back requesting to re-send a particular envelope he didn’t receive.
Unlike UDP, TCP protocol requires that you establish a connection first. So if Henry is to send mail using TCP protocol, he has to first establish a connection to John. Once a connection is established, Henry then sends the first envelope and waits for John to acknowledge that he had received it. Once Henry gets the acknowledgment from John that envelope 1 is safely received, Henry can send envelope 2. The process repeats until Henry tells John that he had sent all the envelopes.
Now unlike in UDP, using TCP protocol John is guaranteed to have all the envelopes in the correct order because Henry will send one envelop and waits for acknowledgment from John, then sends the next envelope and so on and so forth. For more technical description of TCP, please visit Wikipedia site here.