1
00:00:00,000 --> 00:00:04,000
- [Instructor] TCP and UDP utilize the two connection types:

2
00:00:04,000 --> 00:00:07,003
connection oriented and connectionless.

3
00:00:07,003 --> 00:00:10,005
Transmission Control Protocol or TCP

4
00:00:10,005 --> 00:00:13,002
is considered connection oriented.

5
00:00:13,002 --> 00:00:14,009
This means it uses a system

6
00:00:14,009 --> 00:00:17,007
to provide reliable delivery of traffic.

7
00:00:17,007 --> 00:00:21,003
TCP utilizes a system known as the three-way handshake

8
00:00:21,003 --> 00:00:23,002
to establish connections.

9
00:00:23,002 --> 00:00:25,008
Before a connection is considered established,

10
00:00:25,008 --> 00:00:28,009
both hosts need to send and receive a SYN packet

11
00:00:28,009 --> 00:00:30,004
and an ACK packet.

12
00:00:30,004 --> 00:00:33,003
Technically, this could be four separate messages,

13
00:00:33,003 --> 00:00:34,009
but one of these transmissions

14
00:00:34,009 --> 00:00:37,001
can include both a SYN and an ACK.

15
00:00:37,001 --> 00:00:39,004
Thus, we have a three-way handshake.

16
00:00:39,004 --> 00:00:42,009
First, the client host will initiate the interaction

17
00:00:42,009 --> 00:00:45,001
to the server by sending a SYN packet.

18
00:00:45,001 --> 00:00:47,007
The client then waits for a response.

19
00:00:47,007 --> 00:00:50,001
Second, the server responds to the client

20
00:00:50,001 --> 00:00:52,002
by sending a SYN/ACK packet.

21
00:00:52,002 --> 00:00:55,005
Third and last, the client then completes the handshake

22
00:00:55,005 --> 00:00:57,002
by returning an ACK.

23
00:00:57,002 --> 00:00:59,005
The ACK packet is part of the positive

24
00:00:59,005 --> 00:01:02,002
acknowledgement system of TCP.

25
00:01:02,002 --> 00:01:04,001
Once enough information is sent,

26
00:01:04,001 --> 00:01:07,003
TCP will wait for an ACK or acknowledgement.

27
00:01:07,003 --> 00:01:09,005
The amount of information that can be sent

28
00:01:09,005 --> 00:01:13,007
before a response is necessary is known as the window size.

29
00:01:13,007 --> 00:01:15,003
Once an ACK is received,

30
00:01:15,003 --> 00:01:18,005
the client knows it's good to continue sending.

31
00:01:18,005 --> 00:01:21,007
If no ACK is returned, then the previous information

32
00:01:21,007 --> 00:01:25,002
must have been lost in transit and is resent.

33
00:01:25,002 --> 00:01:29,001
The resending of packets is known as retransmission.

34
00:01:29,001 --> 00:01:31,005
Packets also contain a sequence number.

35
00:01:31,005 --> 00:01:33,000
This allows the receiving host

36
00:01:33,000 --> 00:01:35,006
to determine if it missed any packets.

37
00:01:35,006 --> 00:01:37,008
If it determines that it has missed a packet,

38
00:01:37,008 --> 00:01:39,005
it will request from the sender

39
00:01:39,005 --> 00:01:42,008
retransmissions of the missing information.

40
00:01:42,008 --> 00:01:45,006
TCP is especially useful for unreliable

41
00:01:45,006 --> 00:01:48,000
or often congested networks.

42
00:01:48,000 --> 00:01:49,003
This was very important

43
00:01:49,003 --> 00:01:51,009
in the early days of half duplex networks

44
00:01:51,009 --> 00:01:55,004
producing collisions resulting in packet loss.

45
00:01:55,004 --> 00:01:56,006
There are some cases

46
00:01:56,006 --> 00:01:59,001
where reliable delivery isn't necessary.

47
00:01:59,001 --> 00:02:04,005
And for this, the User Datagram Protocol or UDP is used.

48
00:02:04,005 --> 00:02:07,000
With UDP, when information is sent,

49
00:02:07,000 --> 00:02:10,004
it is done so with no acknowledgements, no ordering,

50
00:02:10,004 --> 00:02:12,003
and no duplication protection.

51
00:02:12,003 --> 00:02:15,007
It's for these reasons it's considered connectionless.

52
00:02:15,007 --> 00:02:20,007
This means UDP can transmit information far faster than TCP.

53
00:02:20,007 --> 00:02:22,007
It no longer waits for acknowledgements,

54
00:02:22,007 --> 00:02:26,001
which on far-flung networks produces delays.

55
00:02:26,001 --> 00:02:27,005
This speed does mean

56
00:02:27,005 --> 00:02:29,007
that an occasional dropped packet will happen,

57
00:02:29,007 --> 00:02:33,000
but services that use UDP generally prefer speed

58
00:02:33,000 --> 00:02:35,007
over 100% reliability.

59
00:02:35,007 --> 00:02:39,000
Voice over IP or VoIP and video streaming

60
00:02:39,000 --> 00:02:41,006
are far more concerned with getting the packets there

61
00:02:41,006 --> 00:02:43,001
in a timely manner

62
00:02:43,001 --> 00:02:45,006
as opposed to missing an occasional packet.

63
00:02:45,006 --> 00:02:51,000
Remember, it's TCP for reliability and UDP for speed.

