- [Instructor] TCP and UDP utilize the two connection types:
connection oriented and connectionless.
Transmission Control Protocol or TCP
is considered connection oriented.
This means it uses a system
to provide reliable delivery of traffic.
TCP utilizes a system known as the three-way handshake
to establish connections.
Before a connection is considered established,
both hosts need to send and receive a SYN packet
and an ACK packet.
Technically, this could be four separate messages,
but one of these transmissions
can include both a SYN and an ACK.
Thus, we have a three-way handshake.
First, the client host will initiate the interaction
to the server by sending a SYN packet.
The client then waits for a response.
Second, the server responds to the client
by sending a SYN/ACK packet.
Third and last, the client then completes the handshake
by returning an ACK.
The ACK packet is part of the positive
acknowledgement system of TCP.
Once enough information is sent,
TCP will wait for an ACK or acknowledgement.
The amount of information that can be sent
before a response is necessary is known as the window size.
Once an ACK is received,
the client knows it's good to continue sending.
If no ACK is returned, then the previous information
must have been lost in transit and is resent.
The resending of packets is known as retransmission.
Packets also contain a sequence number.
This allows the receiving host
to determine if it missed any packets.
If it determines that it has missed a packet,
it will request from the sender
retransmissions of the missing information.
TCP is especially useful for unreliable
or often congested networks.
This was very important
in the early days of half duplex networks
producing collisions resulting in packet loss.
There are some cases
where reliable delivery isn't necessary.
And for this, the User Datagram Protocol or UDP is used.
With UDP, when information is sent,
it is done so with no acknowledgements, no ordering,
and no duplication protection.
It's for these reasons it's considered connectionless.
This means UDP can transmit information far faster than TCP.
It no longer waits for acknowledgements,
which on far-flung networks produces delays.
This speed does mean
that an occasional dropped packet will happen,
but services that use UDP generally prefer speed
over 100% reliability.
Voice over IP or VoIP and video streaming
are far more concerned with getting the packets there
in a timely manner
as opposed to missing an occasional packet.
Remember, it's TCP for reliability and UDP for speed.