159: TCP: Transmission Control Protocol.

Take Up Code - A podcast by Take Up Code: build your own computer games, apps, and robotics with podcasts and live classes

Categories:

Knowing where to send information through IP is not enough. You have to know how to reliably send information too. What is TCP and why is it needed? Imagine for a moment that you need to send a very large package by postal mail. The package is just a bunch of papers so it’s not like you’re trying to send a single bulky item. Even so, let’s assume that the package is going to a different country that has unreliable service, especially for big items. And let’s also assume that the stamps are free. How would you send this? Well, you could put everything in one big box and just send it. All those papers are an important document, so you make arrangements that the person you’re sending it to will send you a reply. The reply is very small so has a good chance of making it back but even that is not guaranteed. Okay, you send the package and get no response. Did it arrive? Or did the reply get lost? You don’t know. I’m going to call the reply an acknowledgement or just ack for short. Since you got no reply, you decide to send the whole thing again. And again, you get no ack. What you need is reliable delivery of information and that’s the main purpose of TCP. You need to be able to break the information into small pieces which is easy for a document with multiple pages. It’s also easy for electronic information. That’s because it doesn’t matter what you’re sending. It could be a single large presentation or a picture. Or it could be a document. All of these can be and actually need to be translated into a series of one’s and zero’s anyway. We can just divide these bits into smaller groups just like how a line of people waiting to be let into a store can be let in in groups. Make sure to listen to the full episode for how TCP relates to the problem of sending many pages of a document through an unreliable mail service. Or you can also read the full transcript below. There are several problems that need to be solved including missing packets, packets arriving out of order, duplicate packets, flow control, and error detection. Transcript In the last episode, I explained IP, or Internet Protocol. Along with this, you’ll commonly need to work with TCP, or Transmission Control Protocol. Together, these two are referred to as TCP/IP which is pronounced as just TCPIP. But what is TCP and why is it needed? Imagine for a moment that you need to send a very large package by postal mail. The package is just a bunch of papers so it’s not like you’re trying to send a single bulky item. Even so, let’s assume that the package is going to a different country that has unreliable service, especially for big items. And let’s also assume that the stamps are free. How would you send this? Well, you could put everything in one big box and just send it. All those papers are an important document, so you make arrangements that the person you’re sending it to will send you a reply. The reply is very small so has a good chance of making it back but even that is not guaranteed. Okay, you send the package and get no response. Did it arrive? Or did the reply get lost? You don’t know. I’m going to call the reply an acknowledgement or just ack for short. Since you got no reply, you decide to send the whole thing again. And again, you get no ack. You know the address of the person you’re trying to send the document to. That’s similar to an IP address. You realize that you need a better system for sending large documents. And that’s the purpose of TCP. Now TCP is actually rather complicated. It’s more than I can explain in this podcast without putting you to sleep. So instead, I’m going to continue using the mail example to explain the main concepts. What you need is reliable delivery of information and that’s the main purpose of TCP. You need to be able to break the information into small pieces which