1 00:00:00,240 --> 00:00:02,520 Layer 4, the transport layer. 2 00:00:02,520 --> 00:00:05,100 Now, the transport layer is our dividing line 3 00:00:05,100 --> 00:00:08,070 between what we call the upper layers of the OSI model 4 00:00:08,070 --> 00:00:10,590 and the lower layers of that OSI model. 5 00:00:10,590 --> 00:00:12,330 Now, we've already covered the lower layers 6 00:00:12,330 --> 00:00:13,740 when we talked about the physical, 7 00:00:13,740 --> 00:00:15,870 the data link, and the network layers. 8 00:00:15,870 --> 00:00:18,360 And so now we're going to move into the upper layers, 9 00:00:18,360 --> 00:00:20,850 starting with this layer, the transport layer, 10 00:00:20,850 --> 00:00:23,190 the session layer, the presentation layer, 11 00:00:23,190 --> 00:00:24,900 and the application layer. 12 00:00:24,900 --> 00:00:26,460 Now in the next couple of lessons, 13 00:00:26,460 --> 00:00:29,040 we're going to cover each of these as we go forward. 14 00:00:29,040 --> 00:00:31,170 Now, segment is our data type here 15 00:00:31,170 --> 00:00:33,360 when we're dealing with the transport layer. 16 00:00:33,360 --> 00:00:35,460 When we deal with segments and datagrams, 17 00:00:35,460 --> 00:00:37,980 we're talking about the transport layer. 18 00:00:37,980 --> 00:00:39,510 Now, as we talk about datagrams, 19 00:00:39,510 --> 00:00:42,330 we're going to go into those a little bit more later in depth. 20 00:00:42,330 --> 00:00:44,670 But for now, let's focus on the two protocols 21 00:00:44,670 --> 00:00:46,740 that we have inside Layer 4, 22 00:00:46,740 --> 00:00:49,890 which are the TCP and the UDP protocols. 23 00:00:49,890 --> 00:00:50,940 And we're also going to introduce 24 00:00:50,940 --> 00:00:53,370 a couple of extra reliability features here, 25 00:00:53,370 --> 00:00:55,890 known as windowing and buffering. 26 00:00:55,890 --> 00:00:58,200 Now, what is TCP? 27 00:00:58,200 --> 00:01:01,140 TCP is a transmission control protocol. 28 00:01:01,140 --> 00:01:03,210 It is a connection-oriented protocol, 29 00:01:03,210 --> 00:01:04,860 which means it's a reliable way 30 00:01:04,860 --> 00:01:07,950 to transport segments across our network. 31 00:01:07,950 --> 00:01:09,450 Now, if a segment is dropped, 32 00:01:09,450 --> 00:01:11,670 the protocol will actually ask for acknowledgement 33 00:01:11,670 --> 00:01:12,900 each and every time. 34 00:01:12,900 --> 00:01:14,760 If it doesn't get that acknowledgement, 35 00:01:14,760 --> 00:01:17,400 it's going to resend that piece of information. 36 00:01:17,400 --> 00:01:20,280 That's why we call this a connection-full protocol, 37 00:01:20,280 --> 00:01:22,800 because it has this two-way type of information 38 00:01:22,800 --> 00:01:24,150 where I'm sending you information 39 00:01:24,150 --> 00:01:26,040 and I'm verifying that you actually got it 40 00:01:26,040 --> 00:01:27,330 by listening that you got it 41 00:01:27,330 --> 00:01:29,010 and you give me a response. 42 00:01:29,010 --> 00:01:30,510 Now, let's look at this little diagram 43 00:01:30,510 --> 00:01:32,070 here on the screen for a second. 44 00:01:32,070 --> 00:01:34,080 You're going to see that I have a client on the left 45 00:01:34,080 --> 00:01:35,670 and a server on the right. 46 00:01:35,670 --> 00:01:38,730 Now, the client is going to send what's called a SYN packet, 47 00:01:38,730 --> 00:01:40,380 or a synchronization packet, 48 00:01:40,380 --> 00:01:41,820 over to the server. 49 00:01:41,820 --> 00:01:43,110 Now, when the server gets that, 50 00:01:43,110 --> 00:01:45,780 it's going to send back a synchronization acknowledgement 51 00:01:45,780 --> 00:01:46,613 to the client, 52 00:01:46,613 --> 00:01:48,450 known as a SYN-ACK. 53 00:01:48,450 --> 00:01:50,610 Now, when the client gets that acknowledgement, 54 00:01:50,610 --> 00:01:53,250 it's going to send back its own acknowledgement to the server. 55 00:01:53,250 --> 00:01:54,930 This is known as the ACK. 56 00:01:54,930 --> 00:01:57,810 Now when we do this SYN, SYN-ACK, ACK, 57 00:01:57,810 --> 00:02:00,900 this is what we refer to as a three-way handshake. 58 00:02:00,900 --> 00:02:02,677 Essentially, it's the client going, 59 00:02:02,677 --> 00:02:05,310 "Hey, server, are you ready to get some information?" 60 00:02:05,310 --> 00:02:07,267 And then the server says, "Sure, why not? 61 00:02:07,267 --> 00:02:08,789 "Send me some information." 62 00:02:08,789 --> 00:02:11,280 And the client says, "Okay, here it comes." 63 00:02:11,280 --> 00:02:13,500 And then the transmission is going to begin. 64 00:02:13,500 --> 00:02:15,780 Because we've established that three-way handshake, 65 00:02:15,780 --> 00:02:18,607 and we know that both sides are ready to communicate. 66 00:02:18,607 --> 00:02:19,777 "Now, are you ready?" 67 00:02:19,777 --> 00:02:20,977 "Yes, I am." 68 00:02:20,977 --> 00:02:22,440 "Here it comes." 69 00:02:22,440 --> 00:02:23,790 Now, every time this data, 70 00:02:23,790 --> 00:02:24,750 which we call a segment, 71 00:02:24,750 --> 00:02:26,340 is sent across the network, 72 00:02:26,340 --> 00:02:28,650 there is going to be an acknowledgement that it was received, 73 00:02:28,650 --> 00:02:29,580 and that tells us 74 00:02:29,580 --> 00:02:32,610 there was successful two-way communication occurring. 75 00:02:32,610 --> 00:02:34,230 Now, if the server's expecting to get 76 00:02:34,230 --> 00:02:36,000 100 pieces of information 77 00:02:36,000 --> 00:02:38,130 but it only got 98 of those, 78 00:02:38,130 --> 00:02:39,247 it's going to say to the client, 79 00:02:39,247 --> 00:02:41,947 "Hey, you told me you were going to send me 100 things, 80 00:02:41,947 --> 00:02:43,807 "but you only sent me 98. 81 00:02:43,807 --> 00:02:46,080 "Send me over those two things that I'm missing." 82 00:02:46,080 --> 00:02:48,360 And then a retransmission occurs. 83 00:02:48,360 --> 00:02:50,970 This way, the communication can go forth, 84 00:02:50,970 --> 00:02:51,870 and we can always make sure 85 00:02:51,870 --> 00:02:53,100 we're getting what we're supposed to 86 00:02:53,100 --> 00:02:55,080 because we have this resending of the packets 87 00:02:55,080 --> 00:02:56,550 across the network. 88 00:02:56,550 --> 00:02:58,800 Now, this is used for all network data 89 00:02:58,800 --> 00:03:02,460 that needs to be assured to get to its final destination. 90 00:03:02,460 --> 00:03:05,100 I like to think about this like certified mail. 91 00:03:05,100 --> 00:03:08,100 If I want to send a message to the IRS, for example, 92 00:03:08,100 --> 00:03:09,630 I want to make sure that they get it 93 00:03:09,630 --> 00:03:11,250 and it doesn't get lost in the mail. 94 00:03:11,250 --> 00:03:13,230 So I might pay a little extra money 95 00:03:13,230 --> 00:03:14,760 to get a certified receipt 96 00:03:14,760 --> 00:03:15,810 that when it gets there, 97 00:03:15,810 --> 00:03:16,710 they have to sign it, 98 00:03:16,710 --> 00:03:18,450 and that gets mailed back to me. 99 00:03:18,450 --> 00:03:20,370 This way, when I get that receipt back, 100 00:03:20,370 --> 00:03:23,130 I know that the IRS got my mail package. 101 00:03:23,130 --> 00:03:25,620 That's the way TCP works. 102 00:03:25,620 --> 00:03:26,850 Now, on the other hand, 103 00:03:26,850 --> 00:03:29,880 we have another protocol known as UDP. 104 00:03:29,880 --> 00:03:32,850 UDP is what we call a connectionless protocol, 105 00:03:32,850 --> 00:03:35,400 meaning it doesn't have to wait for connections. 106 00:03:35,400 --> 00:03:38,247 UDP stands for the user datagram protocol. 107 00:03:38,247 --> 00:03:39,900 And the reason why we call it a datagram 108 00:03:39,900 --> 00:03:41,790 is because if you're using UDP, 109 00:03:41,790 --> 00:03:43,410 you're using this type of data. 110 00:03:43,410 --> 00:03:44,850 It's called a datagram. 111 00:03:44,850 --> 00:03:46,170 And so for the exam, 112 00:03:46,170 --> 00:03:47,100 I want you to remember 113 00:03:47,100 --> 00:03:50,940 that Layer 4 is for segments almost exclusively 114 00:03:50,940 --> 00:03:53,280 because we use it with TCP. 115 00:03:53,280 --> 00:03:55,290 But if you're using UDP, 116 00:03:55,290 --> 00:03:57,360 this is now called a datagram. 117 00:03:57,360 --> 00:03:59,790 So if you have a datagram or a segment, 118 00:03:59,790 --> 00:04:01,470 you're in Layer 4. 119 00:04:01,470 --> 00:04:03,537 Now, when we talk about UDP, 120 00:04:03,537 --> 00:04:05,280 UDP is unreliable, 121 00:04:05,280 --> 00:04:07,710 and it transmits segments called datagrams, 122 00:04:07,710 --> 00:04:08,730 and if they're dropped, 123 00:04:08,730 --> 00:04:11,250 the sender will never even know that it happened. 124 00:04:11,250 --> 00:04:13,050 Now, why would I want to send stuff 125 00:04:13,050 --> 00:04:14,520 where the sender isn't aware of it 126 00:04:14,520 --> 00:04:16,470 and I don't get any kind of receipt? 127 00:04:16,470 --> 00:04:20,100 Well, UDP is really good for audio and visual streaming 128 00:04:20,100 --> 00:04:22,140 because you send a lot of data 129 00:04:22,140 --> 00:04:24,840 and there's a lot less overhead when you use UDP 130 00:04:24,840 --> 00:04:27,060 because we don't have that constant three-way handshake 131 00:04:27,060 --> 00:04:28,200 to establish it 132 00:04:28,200 --> 00:04:30,060 and we don't have all the checks and balances 133 00:04:30,060 --> 00:04:33,060 that are associated by using TCP. 134 00:04:33,060 --> 00:04:34,740 So by using UDP, 135 00:04:34,740 --> 00:04:37,380 you can really increase the performance of your network 136 00:04:37,380 --> 00:04:40,020 because you're going to have zero retransmissions. 137 00:04:40,020 --> 00:04:42,120 You're just going to end up dropping information. 138 00:04:42,120 --> 00:04:43,710 Now, isn't that a bad thing? 139 00:04:43,710 --> 00:04:45,780 Why would we want to drop information? 140 00:04:45,780 --> 00:04:47,520 Well, for certain applications, 141 00:04:47,520 --> 00:04:48,990 it really doesn't matter. 142 00:04:48,990 --> 00:04:51,690 For example, you're streaming this video right now, 143 00:04:51,690 --> 00:04:54,330 and if I dropped out for one 1/100th of a second, 144 00:04:54,330 --> 00:04:55,770 would you even notice? 145 00:04:55,770 --> 00:04:57,180 Well, you probably wouldn't. 146 00:04:57,180 --> 00:04:59,040 And that's why UDP is so good 147 00:04:59,040 --> 00:05:01,740 because we can drop one 1/100ths of the time here 148 00:05:01,740 --> 00:05:03,540 and you're really never even going to notice it, 149 00:05:03,540 --> 00:05:05,370 and there won't be a retransmission. 150 00:05:05,370 --> 00:05:06,960 But with TCP, 151 00:05:06,960 --> 00:05:08,550 it's going to lead to a lot more buffering 152 00:05:08,550 --> 00:05:09,660 because you have to wait 153 00:05:09,660 --> 00:05:10,890 and then get it resent to you 154 00:05:10,890 --> 00:05:12,060 and then put it in the right place 155 00:05:12,060 --> 00:05:13,500 and then play it back. 156 00:05:13,500 --> 00:05:16,020 And so because of that acknowledgement and that overhead 157 00:05:16,020 --> 00:05:18,120 for every single second of this video, 158 00:05:18,120 --> 00:05:20,130 it's going to end up making it a lot larger 159 00:05:20,130 --> 00:05:22,050 and use a lot more bandwidth. 160 00:05:22,050 --> 00:05:24,480 And that's one of the big reasons why we use UDP 161 00:05:24,480 --> 00:05:26,910 for video streaming and audio streaming. 162 00:05:26,910 --> 00:05:30,990 Now, let's do a quick little summary here of TCP versus UDP 163 00:05:30,990 --> 00:05:33,630 because this is a really, really important concept. 164 00:05:33,630 --> 00:05:35,850 In fact, if you have your notes out right now, 165 00:05:35,850 --> 00:05:37,380 I would write down this chart 166 00:05:37,380 --> 00:05:38,670 that I'm going to tell you right now 167 00:05:38,670 --> 00:05:40,770 as we talk about TCP versus UDP, 168 00:05:40,770 --> 00:05:43,020 because it really is that important. 169 00:05:43,020 --> 00:05:45,600 Now, first, TCP is reliable. 170 00:05:45,600 --> 00:05:47,070 It has a three-way handshake, 171 00:05:47,070 --> 00:05:49,290 where UDP is not very reliable. 172 00:05:49,290 --> 00:05:50,760 It's an unreliable protocol 173 00:05:50,760 --> 00:05:53,400 because there is no three-way handshake. 174 00:05:53,400 --> 00:05:55,740 TCP is what we call connection-oriented 175 00:05:55,740 --> 00:05:57,810 or a connection-full protocol 176 00:05:57,810 --> 00:05:59,130 because we have that three-way handshake 177 00:05:59,130 --> 00:06:00,210 and the acknowledgements. 178 00:06:00,210 --> 00:06:02,880 But UDP is connectionless. 179 00:06:02,880 --> 00:06:04,770 It's a fire-and-forget method. 180 00:06:04,770 --> 00:06:06,390 I just start sending out information, 181 00:06:06,390 --> 00:06:08,880 and hopefully you're going to get it. 182 00:06:08,880 --> 00:06:12,420 TCP uses segment retransmission and flow control 183 00:06:12,420 --> 00:06:13,980 that's being handled through windowing, 184 00:06:13,980 --> 00:06:16,590 which we're going to talk about more in just a second. 185 00:06:16,590 --> 00:06:17,790 UDP, on the other hand, 186 00:06:17,790 --> 00:06:20,760 there is no retransmission and no windowing. 187 00:06:20,760 --> 00:06:23,670 With TCP, we have segmentation of our sequencing 188 00:06:23,670 --> 00:06:25,350 of all of our different segments. 189 00:06:25,350 --> 00:06:27,930 With UDP, there is no sequencing. 190 00:06:27,930 --> 00:06:30,060 Now, what this means is, as I send everything out, 191 00:06:30,060 --> 00:06:32,130 I'm going to send it out in the proper order, 192 00:06:32,130 --> 00:06:33,240 from 1 to 100. 193 00:06:33,240 --> 00:06:35,790 I'll do this for both TCP and UDP. 194 00:06:35,790 --> 00:06:37,440 Now, if you miss some of those pieces, 195 00:06:37,440 --> 00:06:38,880 or they arrive in a different order 196 00:06:38,880 --> 00:06:41,010 because they take different paths over the network, 197 00:06:41,010 --> 00:06:43,050 with TCP, they're sequencing, 198 00:06:43,050 --> 00:06:44,607 so it knows that you have 1 to 1,000, 199 00:06:44,607 --> 00:06:46,950 and it puts them back in the right sequence. 200 00:06:46,950 --> 00:06:49,380 With UDP, whatever they come in as, 201 00:06:49,380 --> 00:06:51,180 that's how it's going to broadcast it. 202 00:06:51,180 --> 00:06:52,560 And so it can be coming in, 203 00:06:52,560 --> 00:06:57,560 1, 50, 2, 500, 3, 4, 5, 6, 20, 204 00:06:58,350 --> 00:06:59,730 in any random order like that. 205 00:06:59,730 --> 00:07:01,110 And that's how you're going to hear it. 206 00:07:01,110 --> 00:07:03,540 So with video, you may hear a little bit of jumpiness 207 00:07:03,540 --> 00:07:05,310 or a little bit of high-pitch squeaks 208 00:07:05,310 --> 00:07:06,300 or something like that 209 00:07:06,300 --> 00:07:08,850 because one of those frames may have come out of order. 210 00:07:08,850 --> 00:07:09,860 Now, when we go back to TCP, 211 00:07:09,860 --> 00:07:12,540 it is going to acknowledge each of those segments. 212 00:07:12,540 --> 00:07:14,310 And so we have acknowledgement. 213 00:07:14,310 --> 00:07:15,240 If I don't get it, 214 00:07:15,240 --> 00:07:16,350 I know that I didn't get it 215 00:07:16,350 --> 00:07:19,530 and I can get it retransmitted to me and then get it again. 216 00:07:19,530 --> 00:07:21,720 With UDP, there is no acknowledgement. 217 00:07:21,720 --> 00:07:24,750 So, again, UDP has a lot less overhead 218 00:07:24,750 --> 00:07:27,150 because there's no connection, no windowing, 219 00:07:27,150 --> 00:07:31,140 no retransmission, no sequencing, and no acknowledgement. 220 00:07:31,140 --> 00:07:33,150 Now, if you have to get something there 221 00:07:33,150 --> 00:07:35,430 and you want to make sure the person got it, 222 00:07:35,430 --> 00:07:39,120 you really have to use TCP as your protocol of choice. 223 00:07:39,120 --> 00:07:41,460 And that's why we really are going to use TCP 224 00:07:41,460 --> 00:07:43,290 for things like banking and websites 225 00:07:43,290 --> 00:07:45,300 and e-commerce and things like that. 226 00:07:45,300 --> 00:07:46,440 But if we have something 227 00:07:46,440 --> 00:07:49,050 that has a lot of data like audio or video streaming, 228 00:07:49,050 --> 00:07:51,090 UDP really does well with that 229 00:07:51,090 --> 00:07:52,050 because we don't need to get 230 00:07:52,050 --> 00:07:53,850 every single piece of that file. 231 00:07:53,850 --> 00:07:55,380 We can skip a little bit here and there, 232 00:07:55,380 --> 00:07:57,060 and that's okay. 233 00:07:57,060 --> 00:07:58,200 Now, earlier in the lesson, 234 00:07:58,200 --> 00:08:00,420 I mentioned a concept known as windowing, 235 00:08:00,420 --> 00:08:02,040 and I said we'd get to it later. 236 00:08:02,040 --> 00:08:03,330 Well, here we are. 237 00:08:03,330 --> 00:08:04,950 We're going to talk about windowing. 238 00:08:04,950 --> 00:08:06,570 Now, what is windowing? 239 00:08:06,570 --> 00:08:08,070 Windowing is going to allow the clients 240 00:08:08,070 --> 00:08:10,590 to adjust the amount of data in each segment 241 00:08:10,590 --> 00:08:12,720 as it goes through the transmission. 242 00:08:12,720 --> 00:08:14,430 This way, we can continually adjust 243 00:08:14,430 --> 00:08:17,010 to either send more or fewer pieces of data 244 00:08:17,010 --> 00:08:19,680 for each segment that's being transmitted. 245 00:08:19,680 --> 00:08:21,120 So the whole idea here with windowing 246 00:08:21,120 --> 00:08:22,710 is that if you're sending data 247 00:08:22,710 --> 00:08:24,690 and you're getting a lot of retransmissions, 248 00:08:24,690 --> 00:08:26,850 well, you might be sending too much information. 249 00:08:26,850 --> 00:08:28,230 So you need to back that down 250 00:08:28,230 --> 00:08:29,910 and close the window a little bit, 251 00:08:29,910 --> 00:08:31,710 so you'll send less each time. 252 00:08:31,710 --> 00:08:33,690 Now, if you're not getting any retransmissions, 253 00:08:33,690 --> 00:08:35,700 it means you're probably not going fast enough. 254 00:08:35,700 --> 00:08:37,530 So, instead, we can open up that window 255 00:08:37,530 --> 00:08:40,470 and send more data with each of those segments. 256 00:08:40,470 --> 00:08:41,303 And then if we start getting 257 00:08:41,303 --> 00:08:43,289 a lot more of those retransmissions happening again, 258 00:08:43,289 --> 00:08:45,720 well, we start closing that window down. 259 00:08:45,720 --> 00:08:48,150 And so always we're opening and closing the window 260 00:08:48,150 --> 00:08:51,210 to maximize our throughput and our bandwidth here. 261 00:08:51,210 --> 00:08:53,340 So if you ever copied a file over a network 262 00:08:53,340 --> 00:08:54,480 on a Windows machine, 263 00:08:54,480 --> 00:08:56,820 you've probably seen where it starts that movie file 264 00:08:56,820 --> 00:08:57,757 and it starts saying, 265 00:08:57,757 --> 00:08:59,340 "Hey, you have 20 minutes remaining," 266 00:08:59,340 --> 00:09:01,440 and then it drops down to five minutes remaining, 267 00:09:01,440 --> 00:09:03,240 then it jumps up to 50 minutes remaining, 268 00:09:03,240 --> 00:09:04,650 and then 30 minutes remaining, 269 00:09:04,650 --> 00:09:05,730 and then an hour, 270 00:09:05,730 --> 00:09:07,350 and then it goes down to three minutes. 271 00:09:07,350 --> 00:09:09,150 And it has a really hard time estimating 272 00:09:09,150 --> 00:09:10,290 how long it's going to take 273 00:09:10,290 --> 00:09:11,970 to move that really large file 274 00:09:11,970 --> 00:09:14,640 off of your shared drive and onto your Windows computer. 275 00:09:14,640 --> 00:09:15,900 Now, why is that? 276 00:09:15,900 --> 00:09:17,970 Well, that's windowing at work. 277 00:09:17,970 --> 00:09:18,930 What's happening here 278 00:09:18,930 --> 00:09:20,850 is that as there's issues on the network 279 00:09:20,850 --> 00:09:22,830 and there's a lot more retransmissions, 280 00:09:22,830 --> 00:09:25,590 the window decreases, becomes smaller. 281 00:09:25,590 --> 00:09:27,960 And that means we have to send more segments 282 00:09:27,960 --> 00:09:29,070 to get all that data across, 283 00:09:29,070 --> 00:09:30,840 which takes more time. 284 00:09:30,840 --> 00:09:32,640 Now, as things go better 285 00:09:32,640 --> 00:09:34,380 and the network starts flowing again, 286 00:09:34,380 --> 00:09:35,550 that window opens up 287 00:09:35,550 --> 00:09:38,580 and we can send less segments with more data each time, 288 00:09:38,580 --> 00:09:39,450 and that's going to end up 289 00:09:39,450 --> 00:09:42,360 decreasing the time or making it go down. 290 00:09:42,360 --> 00:09:45,150 So what happens here is, as you can see on the screen, 291 00:09:45,150 --> 00:09:47,430 let's say that little green thing is what I'm sending, 292 00:09:47,430 --> 00:09:49,350 and I start sending the information over. 293 00:09:49,350 --> 00:09:51,600 But that red starts creeping up 294 00:09:51,600 --> 00:09:54,030 to where we start to not being able to keep up with it. 295 00:09:54,030 --> 00:09:55,530 So we'll come back down, 296 00:09:55,530 --> 00:09:57,270 and then the red can creep up again, 297 00:09:57,270 --> 00:09:58,620 and then we'll come back down, 298 00:09:58,620 --> 00:09:59,910 and we'll keep doing that. 299 00:09:59,910 --> 00:10:01,500 Hopefully, the red and the green here 300 00:10:01,500 --> 00:10:03,660 will eventually match at a higher level 301 00:10:03,660 --> 00:10:04,707 than it was starting with. 302 00:10:04,707 --> 00:10:06,450 And so as we open up that window 303 00:10:06,450 --> 00:10:07,650 and close that window, 304 00:10:07,650 --> 00:10:09,090 we can start out slow 305 00:10:09,090 --> 00:10:11,490 and then we can go faster by opening up that window 306 00:10:11,490 --> 00:10:13,950 and faster and faster until we have problems, 307 00:10:13,950 --> 00:10:15,900 and then we'll start closing it down again. 308 00:10:15,900 --> 00:10:18,510 And we'll keep doing that over and over and over again 309 00:10:18,510 --> 00:10:20,640 until we get the best bandwidth we can, 310 00:10:20,640 --> 00:10:23,160 as we try to push as much data as we can. 311 00:10:23,160 --> 00:10:26,160 So, for example, if I start counting numbers to you, 312 00:10:26,160 --> 00:10:27,780 I'm going to start going slow. 313 00:10:27,780 --> 00:10:30,780 One, two, three. 314 00:10:30,780 --> 00:10:32,220 That's pretty slow, right? 315 00:10:32,220 --> 00:10:33,877 You'll say, "Okay, okay, I got it, Jason. 316 00:10:33,877 --> 00:10:34,950 "You can go faster." 317 00:10:34,950 --> 00:10:36,480 So I'll start talking faster. 318 00:10:36,480 --> 00:10:39,817 One, two, three, four, five. 319 00:10:39,817 --> 00:10:40,687 "Okay, that's still good. 320 00:10:40,687 --> 00:10:41,820 "Let's try again." 321 00:10:41,820 --> 00:10:42,667 One, two, three, four, five. 322 00:10:42,667 --> 00:10:43,537 "Oh, wait, wait, wait, wait. 323 00:10:43,537 --> 00:10:44,940 "That's too fast, Jason." 324 00:10:44,940 --> 00:10:46,440 Okay, let me slow down. 325 00:10:46,440 --> 00:10:48,570 One, two, three, four, five. 326 00:10:48,570 --> 00:10:49,830 You got it, okay? 327 00:10:49,830 --> 00:10:50,910 And we keep doing that. 328 00:10:50,910 --> 00:10:52,200 That's the idea of windowing. 329 00:10:52,200 --> 00:10:53,730 I'll speed up and I'll slow down 330 00:10:53,730 --> 00:10:54,900 until you don't have any errors 331 00:10:54,900 --> 00:10:56,550 copying down what I'm saying. 332 00:10:56,550 --> 00:10:58,110 That's the whole idea here. 333 00:10:58,110 --> 00:11:00,360 And we want to be able to send as much information to you 334 00:11:00,360 --> 00:11:01,920 as quickly as possible 335 00:11:01,920 --> 00:11:03,990 with the least amount of retransmissions 336 00:11:03,990 --> 00:11:06,840 but still getting the maximum throughput. 337 00:11:06,840 --> 00:11:09,660 Now, the next concept we want to talk about is buffering. 338 00:11:09,660 --> 00:11:11,280 If you've ever watched an online video, 339 00:11:11,280 --> 00:11:13,440 you've probably dealt with buffering before. 340 00:11:13,440 --> 00:11:15,330 Now, devices such as routers 341 00:11:15,330 --> 00:11:16,980 have a special memory in them 342 00:11:16,980 --> 00:11:18,120 that will store segments 343 00:11:18,120 --> 00:11:20,520 if the bandwidth isn't readily available. 344 00:11:20,520 --> 00:11:22,260 Now, this is called the buffer. 345 00:11:22,260 --> 00:11:23,730 So when it becomes available, 346 00:11:23,730 --> 00:11:25,230 it'll go ahead and start transmitting out 347 00:11:25,230 --> 00:11:26,820 the contents of that buffer 348 00:11:26,820 --> 00:11:28,230 and clear itself out. 349 00:11:28,230 --> 00:11:30,510 The same thing happens when you try to load a video. 350 00:11:30,510 --> 00:11:32,250 If the network is congested, 351 00:11:32,250 --> 00:11:34,530 it will take in a lot of information at first 352 00:11:34,530 --> 00:11:36,120 in anticipation of the fact 353 00:11:36,120 --> 00:11:37,710 that you're going to watch it faster 354 00:11:37,710 --> 00:11:40,500 than you're going to be able to download the rest of the video. 355 00:11:40,500 --> 00:11:41,940 And so this is the idea with our buffer 356 00:11:41,940 --> 00:11:43,440 in our routers as well. 357 00:11:43,440 --> 00:11:45,900 So if the buffer is going to overflow, though, 358 00:11:45,900 --> 00:11:48,150 and on a router you only have so much space 359 00:11:48,150 --> 00:11:50,040 and you start putting too much information in there 360 00:11:50,040 --> 00:11:51,390 because you can't send it out, 361 00:11:51,390 --> 00:11:52,920 then what's going to end up happening? 362 00:11:52,920 --> 00:11:54,120 You run out of memory. 363 00:11:54,120 --> 00:11:55,380 And when you run out of memory, 364 00:11:55,380 --> 00:11:56,910 the segments will drop. 365 00:11:56,910 --> 00:11:58,170 So let's look at an example 366 00:11:58,170 --> 00:12:00,330 of how buffering is going to work. 367 00:12:00,330 --> 00:12:02,370 Let's take a look at the buffer on the router. 368 00:12:02,370 --> 00:12:05,130 And here we have Router 4 in our diagram. 369 00:12:05,130 --> 00:12:08,310 Notice how it's kind of the central point of this diagram. 370 00:12:08,310 --> 00:12:11,490 Now, I have stuff coming into it from router number six 371 00:12:11,490 --> 00:12:14,040 and router number one and router number three. 372 00:12:14,040 --> 00:12:15,360 So if I look at all of those, 373 00:12:15,360 --> 00:12:19,230 there's 100 megabits, 100 megabits, and 10 megabits. 374 00:12:19,230 --> 00:12:22,710 That's a possibility of 210 megabits per second 375 00:12:22,710 --> 00:12:25,560 of information going into Router 4. 376 00:12:25,560 --> 00:12:27,360 Now, if it needs to send that information 377 00:12:27,360 --> 00:12:28,740 out to Router 5 378 00:12:28,740 --> 00:12:31,230 and there's only a 50-megabit connection, 379 00:12:31,230 --> 00:12:32,490 you can see pretty quickly 380 00:12:32,490 --> 00:12:34,740 that there's going to be a bottleneck here. 381 00:12:34,740 --> 00:12:36,480 Now, what's going to end up happening for us 382 00:12:36,480 --> 00:12:38,490 is that Router 4 is going to have to catch 383 00:12:38,490 --> 00:12:41,220 all that extra information in its buffer. 384 00:12:41,220 --> 00:12:42,780 And when it has more availability, 385 00:12:42,780 --> 00:12:45,030 it'll send that information out to Router 5 386 00:12:45,030 --> 00:12:46,710 and clear its buffer. 387 00:12:46,710 --> 00:12:50,400 You may ask, "Why would we design a network this way?" 388 00:12:50,400 --> 00:12:51,990 Well, often what's happening here 389 00:12:51,990 --> 00:12:55,560 is there isn't necessarily going to be 100% utilization 390 00:12:55,560 --> 00:12:57,930 from Router 4 to Router 5. 391 00:12:57,930 --> 00:13:00,090 Maybe that's our exterior WAN connection 392 00:13:00,090 --> 00:13:01,560 going out to the internet. 393 00:13:01,560 --> 00:13:03,900 In fact, Router 1 may only be sending you 394 00:13:03,900 --> 00:13:06,510 10 or 15 megabits per second right now, 395 00:13:06,510 --> 00:13:08,580 and Router 3 might be sending you 30, 396 00:13:08,580 --> 00:13:10,680 and Router 6 might be sending you one, 397 00:13:10,680 --> 00:13:13,230 which is all, added together, less than 50, 398 00:13:13,230 --> 00:13:15,030 so no buffering would occur. 399 00:13:15,030 --> 00:13:16,470 Now, there's also the possibility 400 00:13:16,470 --> 00:13:19,860 that Router 1 and Router 3 sends us more information, 401 00:13:19,860 --> 00:13:21,960 and that can cause buffering to occur. 402 00:13:21,960 --> 00:13:24,330 Because Router 4 can't send enough data 403 00:13:24,330 --> 00:13:25,530 out to Router 5 404 00:13:25,530 --> 00:13:27,750 over that 50-megabit-per-second connection. 405 00:13:27,750 --> 00:13:28,770 So this is the idea. 406 00:13:28,770 --> 00:13:30,240 We want to buffer things and hold it, 407 00:13:30,240 --> 00:13:31,500 and then as we have room, 408 00:13:31,500 --> 00:13:33,300 we can send that information out, 409 00:13:33,300 --> 00:13:35,550 clear the buffer, and keep on moving. 410 00:13:35,550 --> 00:13:37,620 Because, when we look at your networks, 411 00:13:37,620 --> 00:13:40,470 the chances are not every device is communicating 412 00:13:40,470 --> 00:13:43,440 to 100% of its capability all of the time. 413 00:13:43,440 --> 00:13:44,580 And so by doing this, 414 00:13:44,580 --> 00:13:47,490 we can pay for a smaller connection to the outside world, 415 00:13:47,490 --> 00:13:49,320 that 50-megabit connection, 416 00:13:49,320 --> 00:13:50,340 as opposed to paying for 417 00:13:50,340 --> 00:13:52,470 a large and expensive fiber connection 418 00:13:52,470 --> 00:13:54,240 of one gigabit per second. 419 00:13:54,240 --> 00:13:55,740 So we can keep our costs down 420 00:13:55,740 --> 00:13:58,350 by knowing what our utilization is over our network 421 00:13:58,350 --> 00:13:59,850 for the long period of time. 422 00:13:59,850 --> 00:14:01,950 Now, that gets into some more advanced concepts that, 423 00:14:01,950 --> 00:14:03,570 as you work as a network engineer, 424 00:14:03,570 --> 00:14:05,520 you'll start working on those designs. 425 00:14:05,520 --> 00:14:07,140 And as bandwidth keeps getting cheaper, 426 00:14:07,140 --> 00:14:09,270 it becomes less and less important for us, 427 00:14:09,270 --> 00:14:11,820 at least in the small office, home-office environment. 428 00:14:11,820 --> 00:14:13,320 But in large corporations, 429 00:14:13,320 --> 00:14:15,030 this is a big deal. 430 00:14:15,030 --> 00:14:18,180 Now, what are some examples of Layer 4 devices? 431 00:14:18,180 --> 00:14:22,050 Well, we have TCP and UDP as our protocols for Layer 4. 432 00:14:22,050 --> 00:14:23,820 So if you see TCP and UDP, 433 00:14:23,820 --> 00:14:25,800 you know you're dealing with Layer 4. 434 00:14:25,800 --> 00:14:27,990 We also have things like WAN accelerators 435 00:14:27,990 --> 00:14:30,660 where we try to add compression to our IP packets, 436 00:14:30,660 --> 00:14:32,490 and then we send those segments over 437 00:14:32,490 --> 00:14:34,020 through those WAN accelerators 438 00:14:34,020 --> 00:14:36,090 to get them through our network faster. 439 00:14:36,090 --> 00:14:38,250 We also have load balancers and firewalls 440 00:14:38,250 --> 00:14:39,780 that can operate at Layer 4 441 00:14:39,780 --> 00:14:42,450 by blocking and allowing different ports and protocols 442 00:14:42,450 --> 00:14:43,350 to go through them. 443 00:14:43,350 --> 00:14:45,480 For example, if you've ever gone in your firewall 444 00:14:45,480 --> 00:14:48,780 and blocked a port like Port 80 over TCP, 445 00:14:48,780 --> 00:14:50,760 well, that is a Layer 4 block 446 00:14:50,760 --> 00:14:52,740 because you're blocking the port, Port 80, 447 00:14:52,740 --> 00:14:53,970 which is web traffic, 448 00:14:53,970 --> 00:14:55,830 and the protocol, TCP, 449 00:14:55,830 --> 00:14:57,783 which is our protocol at Layer 4.