We are a CompTIA Content Publishing Partner. As such, we are able to offer CompTIA exam vouchers at a 10% discount. For more information on how to obtain this discount, please download these PDF instructions.
Skill Level Beginner
- You know, in all these episodes, we've been talking about MAC addresses, and IP addresses, and port numbers, and all this stuff, and what I want to do in this episode, which I call TCP and UDP, is we're gonna put all this together. Now, before we do too much of TCP and UDP, I want you guys to take a look right now and take a look at all my pretty blocks. What we're looking at here is an entire ethernet frame. Now, when we're talking about networking, we're always interested in what's happening inside this frame.
But we're only interested in certain parts of it, like, for example, if we're talking about switches, which use MAC addresses, we're only gonna be interested in the ethernet part. However, if we're talking about IP addresses, we're interested in another part. So, what we do is we have this term called protocol data units, or PDUs. These are really important terminologies, because people tend to interchange this stuff quite a bit. In fact, even with me, Mike Meyers, popular author, telling you what it is, you'll find some variation on this, but trust me the way I'm about to tell you is how 98% of people think about this.
You ready? Here we go. This is an ethernet frame. Everything, we can see our MAC addresses here, all the way down to a frame check sequence. The moment this chunk of data comes off the network card, this stuff gets stripped away. It's just taken off. So the network card passes this information up into the computer itself. So, let's go back one more time. So this is an ethernet frame, all right? That's the PDU when we're talkin' about this.
What we're talkin' about here, this is an IP packet. So when we're talkin' about the IP portion, then you notice the IP address to, the IP address from, some other information in there. So this is what we talk about when we say the IP packet. Now, this only gets the stuff to the computer. So, let's strip this away, and now we're down to TCP and UDP. TCP is a connection-based protocol, and UDP is a connectionless-based protocol.
So if it's TCP, we call it the TCP segment, and if it's UDP, we call it the UDP datagram. Now, let's go ahead and develop this a little bit. Computers in some cases have to have communication that is connection oriented. The reason it has to be connection oriented is, say I'm transferring a word document, or something like that. It has to be right. Every piece has to be there. There's a lot of stuff that happens in networking, where we just send it out and we don't really worry about it too much.
But we have a lot of stuff that's connection oriented. So at this point in the PDU, we break pretty much everything down into TCP, which is connection-oriented communication, and UDP, which is connectionless-oriented. So, it really just depends on what you need to do. So, let's go ahead and talk about TCP and UDP a minute. I've got a whiteboard over here that's gonna be really helpful, in terms of understanding how these two protocols work. So what I've got here is just some computer that wants to talk to some server.
I don't even care what they're doing. This could be a web server, for all I care, or some other type of server. Now, if I wanted to just say some things to somebody really quick, I would use a UDP. And by the way, you, as people, don't do this, do you understand? You buy applications that are already pre-set to handle this. So it's not part of your job to do this. Programmers deal with this. So, let's go ahead and do UDP at the top. In fact, let me write that down. UDP is kinda boring.
With UDP, we just take something, you send it. No response, no talk, no communication, nothing to verify. UDP can be really handy in certain situations, mainly because UDP doesn't have any overhead. So a lot of times, we'll have applications, There's one UDP application called Trivial File Transfer Protocol, is a file transfer protocol. Now you'd think you would want that to be connection-oriented, but we would never use it across the internet. You use it, for example, when you're just plugging one computer into another for a real quick and dirty transfer.
So there are situations where UDP being connectionless can even do things like transfer files. However, gosh, 95, 98% of everything that happens on the internet is TCP. Things that we know and love, like the World Wide Web. Like, just about any type of file transfer program, with the one exception I just mentioned. Remote desktop tools, most games, are all running on TCP.
So, if you're gonna have a connection oriented protocol, you have to go through a very specific what we call hand shake process. And I don't care if you going to get to a web page, or trying to play Counter-Strike Source, you go through this process every time. You're going to have a server, and you're going to have a client, and you go through what's known as, and make sure you know this for the exam, the TCP 3-way hand shake. Clients initiate conversations with servers. So, the first thing that's gonna happen, is the client is gonna send out what's known as a SYN packet.
Again, you don't notice that this is happening, you're just typing in www.google.com, for example, and hitting enter. But this is how the process starts. So, a SYN packet goes over to the server. Once the server sees that, if he's ready, and they usually are, he'll send a very specific response called a SYN/ACK. SYN/ACK is pretty much the "Okay, I'm ready to go. "Let me know when you're ready to go, client." So, the client receives the SYN/ACK, so he knows that the server's ready to go, and then the client then sends an ACK to the server.
Once these three pieces of communication have taken place, you have a TCP connection. From this point forward, until somebody closes the connection, or if somebody just disappears, there'll be a timeout, this connection will stay open on your computer, and you can actually see this on your computer by typing in commands like netstat, for example, which can actually show you all of your connections on your system. Okay, so, that's what it really boils down to when we talk about TCP versus UDP.
These are the two main protocols that make everything that makes TCP/IP go, go so well. Be very comfortable with the concept of UDP being connectionless. Make sure you're comfortable with TCP being connection-oriented. And make sure you're aware of the TCP three way hand shake.