Advanced Networking - #7 TCP/IP & UDP/IP [EN]

Lรถtwig Fusel
6 Jan 202209:29

Summary

TLDRThis video in the advanced networking series explores TCP and UDP, two transport layer protocols essential for data communication between systems. TCP ensures reliable, ordered data transfer with error correction, while UDP prioritizes speed without guaranteeing order or reliability, making it ideal for applications like gaming where speed is crucial. The video also touches on socket programming, allowing multiple services to run on a single system, and highlights the importance of selecting the right protocol for different network communication needs.

Takeaways

  • ๐ŸŒ The video discusses the communication between two computers using ICMP and the need to understand how connections are routed and secured.
  • ๐Ÿ”— The script introduces TCP and UDP as the primary transport layer protocols used for data communication between systems.
  • ๐Ÿ“ฆ TCP and UDP provide end-to-end communication, allowing multiple applications on a single system to communicate with their respective endpoints.
  • ๐Ÿ’ป The concept of socket programming is explained, which involves creating servers and clients to handle communication on specific ports.
  • ๐Ÿ”’ TCP is characterized by its reliability, ensuring packets are received in order and without errors, with mechanisms to resend data if necessary.
  • ๐Ÿš€ UDP is highlighted for its speed, without the overhead of TCP's reliability checks, making it suitable for applications where speed is more critical than order or reliability.
  • ๐Ÿ›‘ TCP includes control mechanisms that can slow down the connection due to its need to wait for acknowledgment of packet receipt before sending the next one.
  • ๐Ÿ”„ UDP, on the other hand, does not guarantee packet order or reliability but allows for faster transmission without waiting for acknowledgments.
  • ๐ŸŽฎ Examples of TCP applications include MySQL, HTTP, HTTPS, and Minecraft, while UDP is used for DNS, SNMP, and online multiplayer games.
  • ๐Ÿ“Š The script contrasts TCP and UDP by highlighting TCP's ordered communication and error correction against UDP's lack of order and error acknowledgment.
  • ๐ŸŽฅ The video includes an animation from the North VPN blog to visually demonstrate the differences between TCP and UDP packet handling.
  • ๐Ÿ”จ The video concludes with a teaser for upcoming content focusing on networking hardware, hinting at the excitement of owning advanced networking equipment.

Q & A

  • What are the main focus areas of the video script?

    -The video script focuses on explaining the concepts of TCP and UDP, their differences, and how they are used in networking for communication between systems.

  • What is the purpose of ICMP discussed in the previous video?

    -ICMP was discussed in the previous video to diagnose the connection between two computers, which is a part of understanding how systems communicate over a network.

  • What does TCP stand for and what are its key elements?

    -TCP stands for Transmission Control Protocol. Its key elements are ensuring that packets are received in the same order they were sent and that each packet is error-free and reliable.

  • What does UDP stand for and how does it differ from TCP?

    -UDP stands for User Datagram Protocol. It differs from TCP in that it does not guarantee the order of packet delivery or reliability. It is faster but does not have the same control mechanisms as TCP.

  • What is the significance of port-based communication in TCP and UDP?

    -Port-based communication allows multiple services to run on the same system and be accessible over the network. Each service listens on a different port number, enabling the system to route incoming data to the correct application.

  • Can you provide an example of how a Minecraft server uses TCP?

    -A Minecraft server uses TCP on port 25565. When a client connects to this port, the data is routed to the Minecraft application, allowing the client to interact with the server.

  • What is socket programming and how does it relate to TCP and UDP?

    -Socket programming is a method of building applications that communicate over a network using TCP or UDP. It involves creating a 'socket' that acts as an endpoint for sending and receiving data between applications.

  • How does TCP ensure reliability in data transmission?

    -TCP ensures reliability by implementing control mechanisms that check the order and integrity of packets. If a packet is lost or corrupted, TCP will resend it until it is successfully received.

  • What are some examples of applications that use TCP?

    -Examples of applications that use TCP include MySQL, HTTP, HTTPS, and Minecraft, which require reliable connections to function correctly.

  • Why might UDP be preferred over TCP in certain scenarios?

    -UDP might be preferred when speed is more critical than reliability, such as in real-time applications like online gaming or VoIP, where minor packet loss or out-of-order delivery is acceptable.

  • What are some differences between TCP and UDP in terms of communication characteristics?

    -TCP is reliable, ordered, and has error correction and acknowledgment of packet receipt. UDP, on the other hand, is faster, does not guarantee order or reliability, and has only basic error detection without acknowledgment.

Outlines

00:00

๐Ÿ”Œ Understanding TCP and UDP Protocols

This paragraph introduces the topic of transport layer protocols, focusing on TCP (Transmission Control Protocol) and UDP (User Datagram Protocol). It explains that these protocols are used for end-to-end communication between systems, allowing for data transfer via port-based endpoints. The paragraph clarifies that TCP ensures reliable, ordered data transmission, while UDP prioritizes speed over reliability. Examples of applications using these protocols, such as web servers, Minecraft, and MySQL for TCP, and DNS, SNMP, and online gaming for UDP, are provided. The concept of socket programming is also mentioned, which allows applications to communicate over these protocols by opening servers on specific ports.

05:02

๐Ÿš€ Comparing TCP and UDP: Reliability vs. Speed

The second paragraph delves into the differences between TCP and UDP, emphasizing TCP's reliability and ordered delivery of packets, which is ideal for applications requiring data integrity, such as HTTP and HTTPS. In contrast, UDP is highlighted for its speed and lack of ordered delivery, making it suitable for real-time applications like online gaming where speed is crucial. The paragraph also discusses the lack of control mechanisms in UDP, which allows it to utilize the full capacity of the network connection without the overhead of ensuring packet order or reliability. Error detection is present in UDP, but there is no retransmission of lost or corrupted packets, unlike TCP, which has a mechanism for resending data to correct errors. The paragraph concludes with an animation reference to visually differentiate the operation of TCP and UDP.

Mindmap

Keywords

๐Ÿ’กICMP

ICMP stands for Internet Control Message Protocol, which is a network-layer protocol used by network devices to communicate error messages and operational information. In the video, ICMP is mentioned as a way to diagnose the connection between two computers, indicating its role in ensuring network communication integrity.

๐Ÿ’กTCP

TCP, or Transmission Control Protocol, is a transport layer protocol that ensures reliable, ordered, and error-checked delivery of a stream of bytes between applications running on hosts communicating via an IP network. The video discusses TCP as a method for establishing a connection between two systems where the data packets are received in the same order they were sent and with confirmation of receipt.

๐Ÿ’กUDP

UDP, or User Datagram Protocol, is another transport layer protocol but unlike TCP, it does not guarantee reliable, ordered, or error-checked delivery of packets. The script explains UDP as a faster alternative to TCP, used when speed is more critical than reliability, such as in online gaming or DNS queries.

๐Ÿ’กEnd-to-end communication

End-to-end communication refers to the communication between two endpoints in a network, ensuring that data is transmitted from the source to the destination without the need for intermediate nodes to understand the data. The video uses this term to describe how TCP and UDP facilitate communication between applications on different systems.

๐Ÿ’กPort-based communication

Port-based communication is a method where each application on a system listens on a specific port number to receive data. The video script mentions this as a way to allow multiple services, like a web server or a Minecraft server, to run on the same system and be distinguishable by their port numbers.

๐Ÿ’กSocket programming

Socket programming is a method of programming where applications create a 'socket' to send and receive data across a network. The video explains that socket programming is built on top of end-to-end communication protocols like TCP and UDP, allowing applications to communicate with each other.

๐Ÿ’กReliable connection

A reliable connection in the context of the video refers to a network connection where data is guaranteed to be delivered in order and without errors. TCP provides this by ensuring that packets are received as they were sent, and if not, they are resent.

๐Ÿ’กControl mechanisms

Control mechanisms in the video refer to the processes and protocols used by TCP to ensure reliable data transmission, such as waiting for acknowledgment of packet receipt before sending the next packet. These mechanisms can slow down the connection due to their need to confirm the successful delivery of each packet.

๐Ÿ’กError detection

Error detection in the video is mentioned in the context of UDP, where it has a basic checksum to determine if a packet has been corrupted in transit. Unlike TCP, UDP does not have mechanisms to correct errors or retransmit packets, it simply discards damaged packets.

๐Ÿ’กAcknowledgment

In the video, acknowledgment refers to the process where the receiving system sends a message back to the sender to confirm that a packet has been received successfully. This is a key feature of TCP, ensuring reliable communication, whereas UDP does not have such a mechanism.

๐Ÿ’กNetwork hardware

Network hardware in the video is hinted at towards the end, suggesting that future content will cover the physical components used in networking, such as routers, switches, and other devices that facilitate the transmission of data across networks.

Highlights

Introduction to a new video on advanced networking series.

Discussion on diagnosing the connection between two computers via ICMP.

Exploration of how connections are routed and secured.

Introduction to the need for communication data over established connections.

Explanation of TCP and UDP as transport layer protocols.

Clarification on the role of port-based end-to-end communication.

Description of how multiple services can run on one system using different endpoints.

Introduction to socket programming for application communication.

Detailed explanation of how TCP ensures reliable data transmission.

Discussion on the control mechanisms of TCP that can slow down the connection.

Examples of applications that use TCP for reliable connections.

Introduction to UDP and its lack of order and reliability in data transmission.

Advantages of UDP in terms of speed and lack of control mechanisms.

Examples of applications that use UDP for speed and efficiency.

Comparison between TCP and UDP in terms of reliability, speed, and communication order.

Use of an animation to visualize the difference between TCP and UDP.

Announcement of upcoming videos focusing on networking hardware.

Encouragement for viewers to like, subscribe, and engage with the content.

Transcripts

play00:00

hello and welcome back to a new video on

play00:01

my advanced networking series in the

play00:04

last video we have talked about how we

play00:07

can communicate or at least diagnose the

play00:10

connection between two

play00:13

computers via icmp and all the

play00:16

networking stuff i mean we don't know

play00:17

the parts that are in between that kind

play00:19

of like revolver and how the connections

play00:22

are

play00:22

routed and how the connections are

play00:25

secured and how we can prevent false

play00:27

code for collections that are not

play00:28

allowed we haven't talked about that but

play00:30

basically we have

play00:31

like made a connection between two

play00:33

systems

play00:34

now we need to also communicate data

play00:36

over that connection

play00:38

and for communicating between

play00:41

two of these systems most of the time

play00:43

tcp or udp is used and that's about it

play00:46

in this video we're going to talk about

play00:47

tcp and udpip

play01:02

all right so let's first talk about what

play01:03

tcp and udp is so both of them are

play01:06

transport layer protocols so they

play01:08

operate on the transport layer they also

play01:11

provide an end-to-end communication as i

play01:12

already told you we have the connection

play01:14

and now we need a communication we have

play01:16

an end-to-end communication which means

play01:17

that we are port-based so we have an

play01:19

endpoint on one system that connects

play01:20

with an end point on another system

play01:23

and by having this port based we can

play01:25

have multiple endpoints so one system

play01:28

could for example provide a web server a

play01:30

minecraft server a mysql server

play01:33

everything that you need within one

play01:34

system and you'll be still able to

play01:37

communicate with each of them because

play01:38

each of these systems of these

play01:40

applications like mysql http hdbs

play01:43

minecraft dns snmp whatever you want to

play01:46

have there

play01:47

all of these protocols are listening to

play01:50

a

play01:50

different endpoint

play01:52

number so for example my uh minecraft is

play01:56

25565

play01:58

is the end point for minecraft and in

play02:01

this case because it's minecraft it is

play02:03

tcp

play02:04

and all of these applications basically

play02:06

built

play02:07

on top of this end-to-end communication

play02:09

and this is called socket programming so

play02:11

basically you can go in and with your c

play02:13

plus plus application windows you can

play02:15

basically just tell windows say hey

play02:18

windows open up a tcp couldn't a tcp

play02:21

server on port 5 for example and then if

play02:25

any other computer would communicate

play02:26

with your windows machine on tcp 5 that

play02:28

data would be routed to your application

play02:31

because you have made a server

play02:33

and if you do a client so you say right

play02:35

windows i want to connect to the

play02:37

following server at port5 then basically

play02:40

windows make sure that this is kind of

play02:42

like sent to the rights or not the right

play02:44

system but at least sent out of one

play02:45

system with the right direction so go to

play02:48

this system with that tcp port and then

play02:51

it reaches some other system and then it

play02:53

basically knows all right you have

play02:54

requested tcp.5 they i have a server

play02:56

running a tcp port five so i'm gonna

play02:59

route this request internally on my

play03:02

target system to that application so

play03:04

basically you have two applications one

play03:05

the client one the server

play03:07

and with tcp and udp they can

play03:09

communicate with each other

play03:11

and making sure that you are actually

play03:13

talking to the correct endpoint and to

play03:15

the correct system

play03:16

let's first talk about tcp which is the

play03:19

short form for transmission control

play03:21

protocol

play03:22

the two key elements of

play03:25

tcp is that a packet that you send is

play03:28

received as it was sent this means in

play03:31

order

play03:32

and with assertion that each data is

play03:34

correct so if you want to have a

play03:36

reliable connection you go for tcp and

play03:38

you basically

play03:40

when you send something you are sure

play03:42

that it is also received by the other

play03:43

system it's not just send and forget

play03:45

it's sent and okay done received or

play03:49

system is not reachable error aborted

play03:52

but basically if a communication is

play03:54

possible tcp will guarantee that each

play03:56

package is received as it was

play03:58

sent the only issue that we have of tcp

play04:01

is that it's control mechanisms that

play04:03

make this

play04:05

source assumption or this this control

play04:07

mechanism that guarantees you that the

play04:09

data is sent as

play04:11

or received as you send these control

play04:13

mechanisms will slow down because for

play04:16

example if you send one packet and the

play04:18

packet is delayed on its way we always

play04:20

need to wait until this one single

play04:22

packet is received until we can send the

play04:24

next one if we

play04:26

cannot just say okay maybe i sent

play04:28

another packet first and then them no we

play04:30

need to wait until it's there and if the

play04:32

packet uh fails to be sent or if the

play04:35

packet is kind of like dropped there was

play04:36

an issue with the packet somehow on the

play04:38

way uh the data got corrupted whatever

play04:40

tcp will resend it and these control

play04:42

mechanisms slow this connection quite

play04:45

down

play04:46

some examples are for tcp are mysql http

play04:49

https minecraft and many many more

play04:52

there's also a second player in the

play04:54

market called udp or user dataframe

play04:56

protocol and basically udp doesn't care

play04:59

in what order packets are received and

play05:02

if they are even received so udp is

play05:04

basically the complete opposite thing

play05:07

odp we just spell out packets and say

play05:11

this is the data i want to send just

play05:12

send it over i don't care if it's

play05:14

received when it's received whatever

play05:16

just do it

play05:18

the

play05:19

my thing on udp is that it can leverage

play05:21

the full speed of the

play05:22

connection full capacity because uh we

play05:25

don't need any control mechanisms we

play05:27

just spill our packages as packages as

play05:29

fast as we can issue we cannot assert

play05:32

that they are receiving in order we

play05:34

cannot assert that they

play05:36

receive ascent so in case basically

play05:38

there's still an error detection in the

play05:40

other piece so if a udp packet gets

play05:42

damaged it's still kind of like rejected

play05:44

from the target system but we don't like

play05:46

we're not we're not gonna resend it

play05:48

we're not gonna know that it got dropped

play05:51

we don't have all that control

play05:52

mechanisms some examples are dns snmp

play05:56

and various games so by default if you

play05:59

have a game

play06:01

a a a online multiplayer game you want

play06:03

to be as fast as possible to clock your

play06:05

servers as fast as they can to make a

play06:07

smooth gameplay we don't want to have 10

play06:09

fps first person shooters online we want

play06:12

to have it

play06:14

desirable at 30 fps

play06:18

or at least 6 30

play06:20

60 fps we want to have

play06:22

a fast server that can do fast decisions

play06:24

and for that each connection to the

play06:26

server must be fast we don't care if a

play06:28

packet gets damaged on the way because

play06:30

well if the user has a bad internet

play06:32

connection and us packages are arriving

play06:34

late or

play06:37

damaged we don't care we

play06:39

do not just just do it so if the user

play06:41

shots but his connection was too bad for

play06:43

really shooting well he hasn't shot

play06:46

or

play06:47

if a user's move event was too slow

play06:49

because he has a bad internet connection

play06:50

he might get hit by some other some

play06:52

other people because he had a bad

play06:54

connection so we kind of like need this

play06:56

assertion for games

play06:59

all right so let's uh take tcp and udp

play07:02

side by side so first of all tcp very

play07:04

reliable while udp is not on the other

play07:07

hand udp is fast while tcp is not

play07:11

tcp allows ordered communication so

play07:14

everything that we send will arrive in

play07:15

the same order uh udp does not do this

play07:18

it's not ordered uh odp on the other

play07:21

hand has just error detection so there's

play07:23

just a a checksum so if there is an

play07:25

error in the packet i'm not gonna allow

play07:27

it on the other hand tcp if there is an

play07:30

error in the packet we ask to resend it

play07:32

so we can correct the error

play07:34

tcp has a receive acknowledge so as soon

play07:37

as the other system

play07:39

receives a packet it tells oh i got your

play07:40

packet

play07:41

while udp does not have such mechanism

play07:43

we just build packets out

play07:46

and to visualize this a bit better here

play07:48

is a nice animation that i have found on

play07:50

the north vpn block

play07:52

it is a german article but in case you

play07:54

understand german you can go to the

play07:56

article and see full description of

play07:58

these animations so basically just to

play08:00

recap here we have a sender and the

play08:02

sender sends the packet over the

play08:03

connection and as soon as the receiver

play08:05

gets it kind of like says check i got it

play08:07

and then the sender sends the next

play08:09

packet while on the other hand uh at udp

play08:12

we just spill our packages over these

play08:14

connections and we don't care if they

play08:15

arrive if maybe some packets get dropped

play08:17

we don't care about this we just spell

play08:19

out packets

play08:22

don't care

play08:24

all right thank you for watching we're

play08:26

going to see us in the next video where

play08:27

we're going to go a bit more hardware

play08:29

sided we have now had many videos of

play08:32

theory and now we are basically at a

play08:34

point where we can understand

play08:37

how basic communication over the network

play08:40

is

play08:40

working

play08:42

and we now can start on learning the

play08:44

networking hardware this is why we are

play08:46

all here because we want to have fancy

play08:47

and expensive hardware that we can show

play08:49

off to our friends and say look i have

play08:51

the 7000 dollar networking equipment in

play08:54

my home to

play08:55

make sure that you log in over a captive

play08:57

portal all right so yeah but we're gonna

play09:00

talk about all of this stuff in the

play09:01

future

play09:03

so thank you for watching make sure to

play09:04

like and subscribe and have a nice day

play09:07

bye

play09:08

[Music]

play09:14

[Music]

play09:28

you

Rate This
โ˜…
โ˜…
โ˜…
โ˜…
โ˜…

5.0 / 5 (0 votes)

Related Tags
TCP/IPUDPNetworkingProtocolsCommunicationReliabilitySpeedTransport LayerSocket ProgrammingEnd-to-End