TCP vs UDP - Explaining Facts and Debunking Myths - TCP Masterclass

Practical Networking
30 Jan 202320:24

Summary

TLDRIn this educational video, Ed Harmush delves into the core differences between TCP and UDP, two fundamental layer 4 protocols of the internet. He clarifies misconceptions, explains the concepts of connection orientation, reliability, flow control, and overhead, and dispels myths like the speed and security of the protocols. The video serves as a foundational guide for understanding the intricacies of TCP's features and UDP's straightforward approach to data transmission.

Takeaways

  • πŸ”Œ TCP and UDP are both Layer 4 protocols that have been essential to the internet for around 40 years.
  • πŸ”— TCP is connection-oriented, requiring an official start and end to a connection, unlike UDP which does not.
  • πŸ“₯ TCP provides reliable service with confirmation of data delivery, while UDP does not confirm whether data has been received.
  • πŸ”„ TCP ensures data is delivered in the correct order with sequence numbers, whereas UDP does not guarantee order and leaves it to the application.
  • πŸ’§ TCP offers flow control to manage data transmission rates based on available bandwidth, but UDP transmits data as fast as possible.
  • 🚫 The term 'UDP is faster' is a myth; latency is the same for both protocols and 'faster' likely refers to UDP's less overhead.
  • πŸ›‘οΈ Contrary to a common myth, TCP does not provide more security; both protocols are equally insecure without additional security measures.
  • ❌ The statement 'UDP is unreliable' is a myth; UDP doesn't provide reliability features at Layer 4 but doesn't make data less likely to arrive.
  • 🚫 Saying 'TCP provides guaranteed delivery' is a myth; TCP can only confirm delivery, not ensure it.
  • πŸ“Š TCP headers are larger due to additional features like sequence numbers and acknowledgment numbers, adding more overhead compared to UDP.
  • πŸ“š Understanding the four major differences and myths about TCP and UDP is crucial for anyone looking to deepen their knowledge of networking protocols.

Q & A

  • What are the two primary protocols discussed in the video?

    -The two primary protocols discussed in the video are TCP (Transmission Control Protocol) and UDP (User Datagram Protocol), both of which are layer 4 protocols in the OSI model.

  • What does the term 'service to service delivery' refer to in the context of TCP and UDP?

    -In the context of TCP and UDP, 'service to service delivery' refers to the process of multiplexing and demultiplexing of traffic, which is the technical term for the main purpose of these protocols to deliver data from one service to another.

  • What are the four dimensions in which TCP and UDP are compared in the video?

    -The four dimensions in which TCP and UDP are compared are connection orientation, reliability, flow control, and overhead.

  • What is the main difference between TCP being connection-oriented and UDP not being connection-oriented?

    -The main difference is that TCP has an official start and end to a connection, requiring a special packet to initiate and another to terminate the connection, while UDP does not have an official start or end and simply sends data onto the wire without such signaling.

  • How does TCP provide reliability in terms of data delivery?

    -TCP provides reliability by offering confirmation of data delivered through acknowledgments, ensuring that the sending host knows when data has reached the receiving host. UDP does not provide such confirmations.

  • What does it mean for TCP to provide 'informed delivery'?

    -Informed delivery in TCP means that the protocol provides confirmations when data is successfully delivered, allowing the sender to be aware of the data's arrival at the receiver, which UDP does not offer.

  • How does TCP ensure the correct order of data delivery to the application?

    -TCP ensures the correct order of data delivery by labeling packets with a sequence number, which allows the receiver to reorder packets if they arrive out of sequence before handing them to the application.

  • What is flow control and how does TCP provide it?

    -Flow control is the regulation of data transmission to prevent data loss by adjusting the rate of transmission based on the available bandwidth. TCP dynamically adjusts its transmission rate to use the maximum available bandwidth without exceeding it, unlike UDP which transmits data as fast as possible.

  • What is the difference in overhead between TCP and UDP?

    -The difference in overhead is the size of the header each protocol adds to the data. TCP adds a larger header with more information to support its features, while UDP adds a smaller header with fewer fields.

  • What are some common myths about TCP and UDP that the video aims to dispel?

    -The video aims to dispel myths such as UDP being faster, TCP being more secure, UDP being unreliable, and TCP providing guaranteed delivery. These myths are clarified with explanations that highlight the actual functionalities and characteristics of the protocols.

  • Why does the instructor dislike the phrase 'TCP is more secure'?

    -The instructor dislikes the phrase 'TCP is more secure' because it is misleading. Neither TCP nor UDP provides inherent security features at the transport layer. Security measures must be applied at other layers, such as using IPSec, SSL/TLS, or SSH.

  • What does the instructor suggest is a better way to describe the reliability of UDP compared to TCP?

    -The instructor suggests that a better way to describe it is to say that UDP doesn't provide reliability features at layer 4, rather than labeling it as 'unreliable'. This is because the actual odds of packet delivery over the network are the same for both TCP and UDP; it's the confirmation of delivery that differs.

  • Why does the instructor dislike the phrase 'TCP provides guaranteed delivery'?

    -The instructor dislikes this phrase because it implies that TCP can ensure packets will always reach their destination, which is not true. TCP provides acknowledgments and can retransmit lost packets, but it cannot guarantee delivery if there are physical issues with the network connection.

Outlines

00:00

πŸ”Œ Introduction to TCP and UDP

This paragraph introduces the topic of TCP (Transmission Control Protocol) and UDP (User Datagram Protocol), two fundamental layer 4 protocols that have been pivotal to the internet's operation for decades. The video aims to provide a comprehensive understanding of these protocols, starting with clarifying what they are and are not. The presenter, Ed Harmush, references previous discussions on the OSI model and service to service delivery, and sets the stage for a series that will delve into the specifics of TCP. The focus is on establishing a foundational understanding before exploring TCP's depth, and viewers are directed to previous content for background information.

05:00

πŸ”— Connection-Oriented vs. Connectionless Communication

The second paragraph delves into the distinction between TCP being connection-oriented and UDP being connectionless. It explains that TCP requires an official start and end to a connection, involving a handshake process where hosts communicate their readiness to send and receive data. This is contrasted with UDP, which does not have a formal connection setup or termination; data is simply sent without such signaling. The paragraph also discusses how UDP 'connections' are conceptualized based on shared attributes like IP addresses and port numbers within a certain time frame, rather than through official connection signals.

10:01

πŸ“₯ Reliability and Data Delivery Confirmation

This section examines the concept of reliability in TCP, which is broken down into three subparts. Firstly, TCP provides confirmation of data delivery, meaning that an acknowledgment is sent by the receiving host, allowing the sender to know the data has arrived. UDP lacks this feature, offering no guarantee or acknowledgment of delivery. Secondly, if data is not delivered over TCP, the sender is informed of the transmission error, which can be communicated to the application for user notification. UDP does not provide this error notification at the transport layer. Lastly, TCP ensures data is delivered in the correct order by using sequence numbers, which is crucial given the potential for packets to take different paths across the internet. UDP does not guarantee order, leaving it to the application to manage if necessary.

15:04

πŸ’§ Flow Control and Bandwidth Management

The fourth paragraph discusses the flow control mechanisms of TCP, which adjusts the transmission rate to match the available bandwidth without data loss, in contrast to UDP's approach of transmitting data as quickly as possible. This can lead to packet loss with UDP when the network path's bandwidth varies. TCP dynamically adjusts to the lowest bandwidth available across the entire path, ensuring efficient use of bandwidth and minimizing packet drops. The paragraph illustrates how TCP starts with a conservative transmission rate and increases it while monitoring for packet loss, adjusting accordingly to maintain optimal transmission without exceeding the available bandwidth.

20:04

πŸ“€ Overhead Comparison: TCP vs. UDP

This paragraph compares the overhead of TCP and UDP, focusing on the size of the headers added to data packets. The UDP header is minimal, consisting of source and destination ports, a length field, and an optional checksum, totaling only eight bytes. In contrast, the TCP header is significantly larger, with a minimum of 20 bytes and potentially expanding up to 60 bytes with options. The larger TCP header is necessary due to the additional features TCP provides, such as sequence and acknowledgment numbers, control flags, window size, and a mandatory checksum. The concept of 'more overhead' versus 'less overhead' is clarified, highlighting the trade-offs between TCP's reliability and control features and UDP's simplicity and lower overhead.

πŸ›‘οΈ Debunking Myths About TCP and UDP

The final paragraph addresses and dispels four common myths about TCP and UDP. The first myth, that UDP is faster, is clarified by explaining that latency is unaffected by the protocol used; 'faster' in this context likely refers to UDP's lower overhead. The second myth, that TCP is more secure, is refuted by stating that neither protocol provides inherent security; security must be implemented at other layers. The third myth, that UDP is unreliable, is nuanced by explaining that while UDP does not provide reliability features at layer 4, it does not inherently make it unreliable, as reliability can be managed by the application. Lastly, the myth that TCP provides guaranteed delivery is corrected to clarify that TCP offers acknowledgment of delivery but cannot ensure delivery in the face of network issues; it can only inform of delivery status.

🎬 Conclusion and Future Lessons

In conclusion, the video outlines the main takeaways, which include understanding the four major differences between TCP and UDP and the myths surrounding them. The presenter expresses a desire to continue the series in-depth, covering additional TCP features such as flags, sliding windows, checksum calculations, flow control algorithms, and TCP options. However, the continuation of the series is contingent upon viewer engagement, urging viewers to like, comment, subscribe, and share the video to ensure its visibility and the production of further content.

Mindmap

Keywords

πŸ’‘TCP

TCP, or Transmission Control Protocol, is a core protocol of the Internet Protocol Suite. It is connection-oriented, meaning it requires a handshake process to establish a connection before data can be transferred and a termination process after the data is sent. TCP ensures reliable data transmission by confirming the delivery of packets and correcting any errors. In the script, TCP is described in detail, including its features like reliability and flow control.

πŸ’‘UDP

UDP, or User Datagram Protocol, is another core protocol of the Internet Protocol Suite, but unlike TCP, it is connectionless. This means that data can be sent without establishing a connection, making it faster but less reliable. UDP does not confirm data delivery or correct errors, which can lead to data loss. The script explains that UDP transmits data without an official start or end to the connection and does not ensure data order or reliability.

πŸ’‘Connection-oriented

A connection-oriented protocol, like TCP, establishes a connection before transmitting data and ensures that the connection is properly terminated after the data is sent. This involves a handshake process at the beginning and an acknowledgment process for each packet sent. The script uses the term to explain one of the fundamental differences between TCP (connection-oriented) and UDP (not connection-oriented).

πŸ’‘Reliable

Reliability in networking refers to the guarantee that data is delivered accurately and in the correct order. TCP is considered reliable because it confirms the receipt of data packets and ensures that any lost or out-of-order packets are retransmitted. The script explains that TCP's reliability includes confirmation of data delivery, error notification, and correct data ordering, in contrast to UDP's lack of these features.

πŸ’‘Multiplexing and Demultiplexing

Multiplexing is the process of combining multiple signals or data streams into one, while demultiplexing is the reverse process, separating a combined signal back into individual streams. TCP and UDP use these processes to manage data streams between applications and the network. The script mentions these concepts to explain how TCP and UDP handle service-to-service delivery.

πŸ’‘Flow Control

Flow control is a feature of TCP that adjusts the rate of data transmission based on the network's capacity to prevent congestion and packet loss. TCP dynamically adjusts its transmission rate to use the available bandwidth efficiently. The script contrasts this with UDP, which sends data as fast as possible without considering network capacity, leading to potential data loss.

πŸ’‘Overhead

Overhead refers to the additional data (headers) added to a packet to manage and control the data transmission process. TCP has more overhead than UDP because it includes extra fields in its header to ensure reliability, flow control, and other features. The script explains the difference in overhead between TCP (20-60 bytes) and UDP (8 bytes) and how this impacts their performance.

πŸ’‘Latency

Latency is the time it takes for a data packet to travel from the source to the destination. The script dispels the myth that UDP is faster than TCP by explaining that the transmission speed (latency) is identical for both protocols; what differs is the overhead and reliability features, not the inherent speed of packet delivery.

πŸ’‘Checksum

A checksum is a value used to verify the integrity of a data packet. TCP includes a mandatory checksum in its header to ensure that data is not corrupted during transmission. UDP also has a checksum, but it is optional. The script mentions checksums when comparing the headers of TCP and UDP and their roles in data integrity.

πŸ’‘Sequence Number

A sequence number is a part of the TCP header used to ensure that data packets are delivered in the correct order. Each packet is assigned a sequence number, allowing the receiving host to reassemble the data in the correct order, even if packets arrive out of sequence. The script explains how TCP uses sequence numbers to provide reliable data delivery, unlike UDP, which does not use sequence numbers.

Highlights

Introduction to TCP and UDP as the workhorses of the internet for the last 40 years.

Exploration of TCP and UDP within the context of the OSI model and their roles in service to service delivery.

Clarification of the terms 'connection-oriented' and 'not connection-oriented' in relation to TCP and UDP.

Explanation of the process of establishing a TCP connection through special packets.

UDP's approach to data transmission without an official connection start or end.

The concept of defining a UDP connection based on timeout and packet attributes.

TCP's reliability through confirmation of data delivery and acknowledgments.

UDP's lack of data delivery confirmation and its implications for error awareness.

The importance of sequence numbers in ensuring the correct order of TCP data delivery.

UDP's lack of intrinsic data ordering and its impact on application-level handling.

TCP's flow control mechanism to dynamically adjust transmission rates based on available bandwidth.

UDP's approach to transmit data as fast as possible without adjusting to bandwidth variations.

The overhead comparison between TCP and UDP, with TCP adding a larger header to data payloads.

Debate on the myth that UDP is faster due to less overhead, and the clarification on latency.

Dispelling the myth that TCP is more secure, emphasizing that neither protocol provides inherent security.

Clarification on the myth that UDP is unreliable, explaining the actual meaning of reliability in protocols.

Debate on the phrase 'TCP provides guaranteed delivery,' explaining the limits of TCP's reliability.

Invitation to the audience to engage with the content for further exploration of TCP's features.

Transcripts

play00:00

it's time to explore TCP and UDP in the

play00:03

true practical networking style get

play00:05

ready to really understand how and why

play00:07

these two layer 4 protocols have been

play00:09

the workhorses of the internet for the

play00:11

better part of the last 40 years

play00:14

[Music]

play00:21

hello everyone my name is Ed harmush and

play00:24

in this video we'll be kicking off what

play00:25

will likely be a pretty thorough series

play00:27

on TCP but before we get into the depth

play00:30

of TCP we have to start on the same page

play00:32

so in this video we're going to be

play00:34

covering TCP and UDP specifically we're

play00:37

going to be talking about what TCP and

play00:38

UDP are and what they are not

play00:41

now if you're looking for some

play00:42

background information before we get

play00:43

into TCP and UDP we first mentioned the

play00:46

concepts of TCP and UDP back in our

play00:48

networking fundamental Series in the

play00:50

lesson on the OSI model in that lesson I

play00:52

showed you this slide and I told you

play00:54

that the main purpose of DCP and UDP is

play00:57

what I like to call service to Service

play00:58

delivery the technical term for this is

play01:00

multiplexing and demultiplexing of

play01:02

traffic

play01:02

in any case in that slide I told you

play01:04

that there are two strategies for how

play01:06

this is done that's where TCP and UDP

play01:08

come into play so if you're looking for

play01:10

some context or background information

play01:11

I'd point you to this video there'll be

play01:13

a link in the description

play01:15

what we're going to do in this video is

play01:17

unpack TCP or the transmission control

play01:19

protocol and UDP or the user datagram

play01:21

protocol across four different

play01:23

dimensions we'll first start by talking

play01:25

about four important differences between

play01:27

TCP and UDP and then I'm going to dispel

play01:29

four common myths about TCP and UDP that

play01:32

I keep hearing about

play01:33

with that said let's get into the first

play01:35

difference that we're going to be

play01:36

talking about and that has to do with

play01:38

TCP being connection oriented and UDP

play01:41

being not connection oriented now if

play01:43

you're anything like me when I first

play01:44

read that about TCP and UDP I had no

play01:47

idea what they meant it actually took a

play01:49

few years before I finally understood

play01:50

what they mean by this and I'd like to

play01:52

communicate that to you now what they

play01:53

mean by connection oriented is that

play01:55

there is an official start and an

play01:57

official in to a TCP connection

play02:00

UDP does not have that so what that

play02:02

means is that before this host can send

play02:04

TCP data packets to the other host it

play02:07

first has to send a special packet that

play02:09

essentially says hey I'd like to start

play02:11

speaking TCP with you let's start a

play02:13

connection

play02:14

and then this host has to respond saying

play02:16

cool I'm ready to speak and now this

play02:18

host can actually start sending data

play02:19

onto the wire

play02:20

then once that host has finished sending

play02:22

the data it needs to send it's then

play02:24

going to send another special packet

play02:26

indicating that it is now done sending

play02:28

data on the wire and this host will

play02:30

respond saying great I've received all

play02:31

the data I am done with this connection

play02:33

as well

play02:34

by comparison UDP does not have an

play02:37

official start or end to the connection

play02:38

if this host wants to send UDP data to

play02:41

that host all it's going to do is simply

play02:43

put that data onto the wire and hope it

play02:45

gets to the other side there isn't any

play02:47

sort of signaling that indicates this is

play02:48

the start of the UDP connection and this

play02:50

is the end of a UDP Connection in fact

play02:52

some people say that there is no such

play02:54

thing as a UDP connection but in modern

play02:57

network engineering parlance people

play02:59

refer to a UDP connection all the time

play03:01

but if there's no official start or end

play03:03

how do we determine which set of packets

play03:05

all belong to the same connection well

play03:07

with UDP all you can really do is Define

play03:09

it based upon the timeout any packets

play03:12

that share the same five double that's

play03:14

Source IP Source Port destination IP

play03:16

destination port and protocol in this

play03:18

case UDP and arrive within the same

play03:19

certain time period can all be said to

play03:21

be a part of the same UDP connection

play03:24

now this timeout is not a constant value

play03:26

I've seen a lot of different values from

play03:27

different vendors and different software

play03:29

two minutes seems to be a pretty common

play03:31

one but by no means is that a standard

play03:33

across the internet

play03:34

in any case that's the first major

play03:36

difference between TCP and UDP that I

play03:38

wanted to unpack for you and hopefully

play03:40

that gives you a much better

play03:41

understanding of the terms connection

play03:42

oriented and not connection oriented

play03:44

than I had when I first started learning

play03:46

networking which brings us to the second

play03:49

attribute we're going to discuss

play03:50

regarding TCP and UDP

play03:52

the next component that we're going to

play03:54

discuss about TCP and UDP is that TCP is

play03:57

said to be reliable but again what do

play03:59

they actually mean when they say TCP is

play04:01

reliable well there's actually three

play04:03

subparts to what is meant by reliable

play04:05

and I'm going to explore each of them

play04:06

for you in the next few minutes the

play04:08

first sub-component of TCP being

play04:10

reliable is this TCP provides

play04:12

confirmation of data delivered what that

play04:15

means is that if this host sends some

play04:17

data to this host every time this host

play04:19

receives that data it's going to send an

play04:21

acknowledgment saying hey I just

play04:22

received that data this means this host

play04:25

knows whenever data actually got to the

play04:27

other side

play04:28

by comparison UDP does not have that UDP

play04:31

doesn't provide any sort of confirmation

play04:33

of data delivery if this host sends UDP

play04:36

packets of this host it's simply going

play04:37

to put those packets on the wire and

play04:39

hope for the best the receiving host

play04:41

isn't going to do any sort of

play04:43

confirmation that the data actually got

play04:44

there

play04:45

that's the first part of what is meant

play04:47

by TCP being reliable now the benefit of

play04:50

this is that if we are confirming every

play04:52

time data is actually delivered that

play04:54

means we are aware if something didn't

play04:55

actually make it through if this host

play04:57

put TCP packets on the wire and never

play05:00

receives that confirmation well this

play05:02

tells this host that something happened

play05:03

with a transmission

play05:05

which means this host can then notify

play05:07

the application which initiated the TCP

play05:09

connection that some sort of error had

play05:10

occurred that's useful because then the

play05:12

application can provide an error message

play05:14

to the user telling the user that some

play05:16

sort of error has occurred

play05:18

UDP doesn't have that since UDP doesn't

play05:21

have any sort of data delivery

play05:22

confirmation

play05:24

UDP is unaware of any errors actually

play05:26

happen

play05:26

meaning if this guy sent UDP packets

play05:29

across the wire and something happened

play05:30

to those packets this guy is not going

play05:32

to know anything about it at layer 4.

play05:35

the application might have their own

play05:37

confirmation of delivery built into the

play05:39

application but none of that is provided

play05:41

by UDP at layer 4. those are the first

play05:43

two subparts to what is meant by TCP

play05:46

being reliable the third and final part

play05:49

of that is this guy with TCP data is

play05:52

delivered to the application in the

play05:54

correct order so here's what I mean by

play05:56

that remember that with typical internet

play05:58

communication it's not like the host is

play06:00

directly singing data to another host

play06:02

instead often it's some sort of

play06:04

application running on this host is

play06:07

telling this host to put certain packets

play06:08

on the wire and send it via TCP or UDP

play06:11

in the case of TCP any packets that the

play06:14

application say to send TCP will label

play06:17

with a particular sequence number for

play06:18

Simplicity I'm just going with one two

play06:20

and three this sequence number can then

play06:22

be used to make sure that on the other

play06:24

side that data is delivered to the

play06:25

application in the correct order

play06:27

now if The Two Hosts are literally

play06:28

connected via same wire then it doesn't

play06:30

really matter because the order in which

play06:32

you put these packets on the wire is the

play06:34

order in which they'll arrive on the

play06:35

other side

play06:36

but often when you're speaking to

play06:37

another host you're speaking to another

play06:39

host on the other side of the internet

play06:40

which means on the other side of a bunch

play06:42

of different routers whose job it is to

play06:44

hand those packets off to one another to

play06:46

deliver them to the final host

play06:48

the issue is that there is no guarantee

play06:50

that those packets are going to be

play06:52

delivered using the same path so what

play06:54

can sometimes happen is maybe the first

play06:56

packet takes the fastest path and the

play06:58

second packet takes the scenic route and

play07:00

the third packet took the fast pass then

play07:02

on the other side what you have is the

play07:03

packets arriving in the order one three

play07:05

two even though on the sending side they

play07:08

are sent as one two and three

play07:10

now in the case of TCP since TCP labeled

play07:13

these packets with a sequence number TCP

play07:16

can switch the packets around as

play07:17

necessary before they actually hand

play07:19

those packets to the application the key

play07:21

there is that the other application is

play07:23

definitely going to receive the data in

play07:25

the correct order

play07:26

UDP doesn't have any sort of intrinsic

play07:29

data ordering which means if the packets

play07:31

arrive on the other host out of order

play07:32

and it's a UDP connection the

play07:35

application is going to have to deal

play07:36

with that in whatever way makes the most

play07:37

sense

play07:38

possibly the application has their own

play07:40

method of sequencing or alternatively

play07:43

possibly the application doesn't really

play07:45

care about the order in which the data

play07:46

writes for instance if I'm downloading a

play07:49

100 megabyte file I don't necessarily

play07:51

care that byte1 gets there before byte

play07:53

100. as long as all the bytes get there

play07:55

I'll be happy so that wraps up talking

play07:57

through the three subparts to what is

play08:00

meant when people say that TCP is

play08:01

reliable

play08:03

notice however I didn't say that UDP was

play08:06

unreliable we'll talk more about that in

play08:08

a moment the third major component about

play08:10

TCP and UDP is that TCP is set to

play08:13

provide flow control and UDP does not

play08:17

let's talk about what that actually

play08:18

means in the case of UDP UDP is going to

play08:21

transmit its data as fast as it possibly

play08:24

can

play08:25

whereas TCP is going to dynamically

play08:27

adjust its transmission rate to use the

play08:30

maximum available bandwidth safely

play08:32

without exceeding it so let me show you

play08:34

what I mean now if you have a situation

play08:36

where the host in communication are

play08:39

speaking across the path with pretty

play08:40

much consistent bandwidth availability

play08:42

then this difference really isn't all

play08:44

that important they both end up

play08:46

achieving about the same transmission

play08:47

rate however most of the time when

play08:50

you're speaking to another host

play08:51

especially another host on the other

play08:52

side of the internet the available

play08:54

bandwidth throughout the path is not

play08:56

consistent often one side of the path

play08:58

has more available bandwidth than the

play09:00

other or more realistically you'd have

play09:02

higher bandwidth here lower bandwidth

play09:04

here higher here lower here higher here

play09:06

or something like that in any case if

play09:08

you were to map out the bandwidth

play09:09

available across the entire path in this

play09:11

illustration you would have something

play09:12

that looks like this

play09:15

now with UDP sending data as fast as it

play09:17

can what would end up happening is this

play09:19

host would look at its local connection

play09:21

and be like whoa look at all this

play09:22

available bandwidth I have I'm going to

play09:24

send data as fast as I possibly can

play09:26

according to this available bandwidth

play09:28

but as you can see we have more

play09:30

available bandwidth here than we do over

play09:32

here

play09:33

so with UDP you'd have a situation that

play09:35

looks like this

play09:37

UDP would be sending data super fast

play09:39

over here but then once it got to this

play09:41

side a lot of that data would be dropped

play09:42

since this side cannot support the same

play09:45

bandwidth transmission rate

play09:47

TCP however would dynamically adjust the

play09:49

transmission rate to stay within the

play09:51

bandwidth across the entire path let me

play09:53

show you with TCP you would have

play09:55

something that looks more like this TCP

play09:58

would start out low and then start

play09:59

increasing the bandwidth but once you

play10:01

start noticing that certain packets are

play10:02

dropped it would start to adjust its

play10:04

bandwidth down to whatever is available

play10:05

for the entire path

play10:07

then TCP would bounce around at that Max

play10:09

available bandwidth

play10:11

now the details of that are rather

play10:13

interesting and we can get into how all

play10:15

that works later on in this series

play10:16

but for now I just want to highlight the

play10:18

significant difference between flow

play10:20

control and how TCP will smartly use the

play10:22

available bandwidth without dropping

play10:24

packets whereas UDP will transmit

play10:26

everything as fast as it possibly can

play10:27

that's what people mean when they say

play10:29

that TCP provides flow control

play10:31

and that takes care of our third major

play10:33

comparison point between TCP and UDP

play10:36

which brings us to our fourth and our

play10:38

fourth is that TCP is more overhead and

play10:41

UDP is less overhead well to understand

play10:44

this one we have to pull back something

play10:45

we learned about the OSI model remember

play10:47

in our lesson on the OSI model we said

play10:49

that the application layers layer 5 6

play10:51

and 7 are going to put together some

play10:53

sort of data that should be sent to the

play10:55

other side

play10:55

the application layers are then going to

play10:57

hand that data to layer 4. and layer 4

play11:00

is going to add a header to that data in

play11:02

order to accomplish layer 4's goals of

play11:04

service to Service delivery

play11:06

then layer 4 is going to hand that to

play11:08

layer 3 and layer 3 is going to add its

play11:11

own header in order to accomplish the

play11:12

goal of layer 3 of end to end delivery

play11:15

and then layer 3 is going to hand that

play11:17

to layer 2 and layer 2 will add its own

play11:19

header in order to accomplish the goals

play11:21

of hop delivery and finally this

play11:23

construct over here known as a frame is

play11:26

then going to be serialized and put on

play11:27

the wire and sent to the other side now

play11:29

if any of that was unfamiliar to you

play11:31

specifically the terms hop to hop end to

play11:34

end and service to service I'd recommend

play11:36

checking out my videos on the OSI model

play11:38

I promise it'll be one of the best takes

play11:40

on the OSI model you've ever seen in any

play11:42

case going back to this comparison Point

play11:44

what is meant by a more overhead and

play11:46

less overhead has to do with the size of

play11:48

the header being added to the data TCP

play11:51

is going to add a larger header to the

play11:53

data compared to UDP let me show you

play11:57

here is what a UDP header would look

play11:59

like notice the UDP header only includes

play12:03

four Fields a source port and a

play12:05

destination port to accomplish the goal

play12:07

of service to Service delivery a length

play12:09

which indicates to the other side how

play12:11

long the entire segment is and finally a

play12:14

checksum and in the case of UDP this

play12:15

checksum is optional

play12:17

notice the entire thing is only eight

play12:19

bytes

play12:21

by comparison the TCP header looks like

play12:23

this notice it is much larger it's

play12:26

actually 20 bytes at minimum and

play12:29

sometimes can be larger if options are

play12:31

included with options the TCP header can

play12:34

be at most 60 bytes

play12:36

either way you can see that it's adding

play12:38

a lot more information to each data

play12:40

payload well that kind of makes sense

play12:42

because TCP has more features and to

play12:45

accomplish these features TCP has to add

play12:48

more information to the data

play12:50

TCP also has a source and destination

play12:52

Port just like UDP TCP doesn't have a

play12:55

length per se but it does have an offset

play12:57

which indicates how long the TCP header

play12:59

is and TCP has a checksum but in the

play13:02

case of TCP it's actually mandatory

play13:05

otherwise all of these fields over here

play13:08

are all new in TCP and don't actually

play13:11

exist in UDP

play13:12

these are the fields which accomplish

play13:14

these features of TCP you're going to be

play13:17

looking at a lot of these fields in more

play13:18

detail in the next lesson

play13:20

for now I just want to really drive home

play13:22

the point of what is meant by more

play13:24

overhead versus less overhead with TCP

play13:26

versus UDP

play13:28

so that takes care of illustrating the

play13:30

core attributes of TCP and UDP

play13:33

next I'd like to discuss and even dispel

play13:36

a few myths about TCP and UDP there are

play13:40

four myths that we're going to be

play13:41

talking through and I'll say at the

play13:43

outset of this that some of these might

play13:45

just be subjective aversions to certain

play13:47

phrases

play13:48

either way I do want you to be able to

play13:51

speak to TCP and UDP smartly so with

play13:53

that said let's talk about the first

play13:55

myth that we're going to dispel and that

play13:57

is that UDP is faster this is not true

play14:01

the speed is actually identical

play14:04

now I'm guessing what people mean when

play14:06

they say UDP is faster is that UDP has

play14:09

less overhead than TCP if that's what

play14:12

they mean then they should use the term

play14:13

less overhead saying UDP is faster

play14:16

implies that a packet sent via UDP will

play14:19

get to the other side faster than a

play14:20

packet sent by TCP

play14:22

the term for how long it takes a packet

play14:24

to get across to the other host is known

play14:26

as leads and the latency is actually

play14:29

completely unaffected whether you're

play14:30

using TCP or UDP

play14:32

so the term UDP is faster is not

play14:35

actually true

play14:36

yes UDP provides less overhide than TCP

play14:39

but you can't actually say a UDP packet

play14:42

is faster and will get to the other side

play14:44

any quicker than a TCP map

play14:46

so that is the first myth that I wanted

play14:48

to spell

play14:49

the second myth is this guy TCP is more

play14:53

secure and if I can be honest with you

play14:55

this is by far the myth that I dislike

play14:57

the most

play14:58

as someone who teaches security and

play15:00

cryptography and SSL and TLS and people

play15:03

say TCP is more secure it really makes

play15:05

my blood Bowl TCP is not more secure the

play15:09

security of both is identical in fact

play15:12

you can say that either protocol is

play15:14

equally insecure since neither protocol

play15:17

provides any sort of security to data

play15:19

packets that are sent onto the wire

play15:21

if you actually want security applied to

play15:24

your data packet you're going to have to

play15:25

apply them in another layer you'll have

play15:27

to use something like ipsec at layer 3

play15:29

or SSL TLS or SSH at layer 5 through 7.

play15:34

but at layer 4 the choice of TCP and UDP

play15:37

is equal security or rather equally

play15:40

insecure

play15:41

so the myth that TCP is more secure is

play15:43

completely untrue

play15:45

anybody that says otherwise is wrong

play15:48

that is the second myth that I wanted to

play15:50

spell for you

play15:51

the third myth is this one UDP is

play15:55

unreliable that's also not true

play15:57

but for this one I actually have some

play16:00

sympathy for it people say that TCP has

play16:02

reliability so wouldn't it make sense to

play16:04

then say UDP is unreliable

play16:06

I get it but a better way of saying that

play16:08

would be something like this

play16:10

UDP doesn't provide a reliability at

play16:13

layer 4.

play16:14

saying it like this tends to give UDP a

play16:16

bad reputation the odds of a packet

play16:19

getting through the wire to the other

play16:20

side are identical whether you're using

play16:22

TCP or UDP the only difference is TCP

play16:26

actually provides confirmation of data

play16:28

delivery whereas UDP does not

play16:31

UDP in fact allows the application to

play16:33

provide any sort of reliability that the

play16:36

application needs it simply doesn't

play16:38

provide any magically at layer 4 like

play16:40

TCP does that's a better way of saying

play16:43

this myth and that is also why I dislike

play16:46

the phrase UDP is unreliable and is also

play16:49

why I avoided saying it earlier in this

play16:51

lesson

play16:52

which brings us to the fourth myth that

play16:54

I want to dispel and that is this one

play16:57

and I'll be honest this one might just

play16:59

be a syntax issue but one way or another

play17:01

the myth is TCP provides guaranteed

play17:04

delivery that is also not true

play17:07

TCP simply provides informed delivery in

play17:11

the sense that TCP provides confirmation

play17:12

of data delivery

play17:14

but TCP cannot guarantee that delivery

play17:17

of packets will get to the other side

play17:19

if something is wrong with the wire

play17:21

Between Two Hosts whether you put a TCP

play17:24

packet on the wire or a UDP packet on

play17:26

The Wire the odds of it getting through

play17:28

or not getting through are identical so

play17:31

TCP can't actually guarantee that

play17:33

anything is actually going to be

play17:34

delivered all TCP is going to do is

play17:37

provide reliability in the sense of we

play17:39

know when data is delivered and

play17:41

therefore we know when data is not

play17:42

delivered TCP cannot magically make data

play17:45

arrive that's why I dislike this phrase

play17:48

of TCP is a guaranteed delivery but

play17:51

again that could just be a phrase that I

play17:53

personally am not a big fan of

play17:55

either way those are the four myths that

play17:57

I wanted to talk through in this video

play17:59

and that in fact wraps up the main

play18:01

things I wanted to cover in this lesson

play18:03

in the next lesson we're going to unpack

play18:05

exactly how TCP provides all these cool

play18:08

features we just got done illustrating

play18:10

and if you understood all the things you

play18:13

went through in this lesson and you'll

play18:14

follow along with everything we're going

play18:16

to go through in the next lesson then

play18:18

you can safely say that you understand

play18:19

TCP better than most but even then these

play18:23

first two lessons are really only

play18:25

scratching the surface with TCP

play18:27

there is so much more to TCP that we

play18:29

could be discussing for instance we

play18:31

could talk through different flags we

play18:33

could talk through the sliding window we

play18:35

could talk through how the checksums are

play18:36

actually calculated we could discuss the

play18:38

different flow control algorithms like

play18:39

TCP Reno and TCP Tahoe we could talk

play18:42

through ecn and cwr and various TCP

play18:44

options some of which exist in pretty

play18:47

much every single TCP connection of the

play18:49

modern era and I am absolutely willing

play18:51

to take the time to create the videos

play18:52

teaching through each of these

play18:54

additional items but if I'm going to do

play18:56

that I need you to do me a favor

play18:59

I put a lot of time and effort into the

play19:01

content I produce my goal is to always

play19:03

create the best possible training

play19:04

content for you but unfortunately that

play19:07

means I can't really keep up with a

play19:09

YouTube weekly delivery schedule which

play19:11

means regrettably my content will never

play19:13

be favored by the YouTube algorithm

play19:15

so if you want me to continue making

play19:17

this TCP series I need you to help me

play19:19

blow up these first two videos

play19:21

do the usual like comment and subscribe

play19:23

but also share links to this amongst

play19:25

your peers or post it on Twitter

play19:27

LinkedIn or Reddit or whatever social

play19:29

media platform you prefer if these two

play19:31

videos get a wide following then I'll

play19:33

happily create content covering the rest

play19:34

of these concepts for you

play19:36

with that said we bring this lesson to a

play19:39

close the main takeaways from this

play19:41

lesson are understanding the four major

play19:43

differences between TCP and UDP and what

play19:46

is actually meant by each of them and

play19:48

also understanding the four myths we

play19:50

dispelled and why each of them might be

play19:51

wrong

play19:52

in the next lesson we're going to go

play19:54

further with TCP and I'll show you how

play19:55

TCP actually provides each of these

play19:57

features

play19:58

but that's it for this lesson I hope you

play20:00

enjoyed this video thank you for

play20:02

watching and I'll see you in the next

play20:04

one

play20:05

thank you

play20:07

[Music]

play20:15

foreign

play20:20

[Music]

Rate This
β˜…
β˜…
β˜…
β˜…
β˜…

5.0 / 5 (0 votes)

Related Tags
TCPUDPNetworkingProtocolsConnectionReliableUnreliableFlow ControlData DeliveryInternet Fundamentals