1 00:00:00,060 --> 00:00:06,750 ‫The transmission control protocol TCP provides a communication service at an intermediate level between 2 00:00:06,750 --> 00:00:09,510 ‫an application program and the internet protocol. 3 00:00:10,320 --> 00:00:15,030 ‫It provides host to host connectivity at the transport layer of the internet model. 4 00:00:16,220 --> 00:00:23,270 ‫DCP works with the Internet Protocol IP, which defines how computers send packets of data to each other. 5 00:00:24,110 --> 00:00:29,480 ‫Together, TCP and IP are basic rules defining the internet. 6 00:00:30,840 --> 00:00:37,980 ‫TCP is a connection oriented protocol, which means a connection is establish and maintain until the 7 00:00:37,980 --> 00:00:41,670 ‫application programs at each end have finished exchanging messages. 8 00:00:43,310 --> 00:00:49,880 ‫It determines how to fragment application data into packets that networks can deliver, sends packets 9 00:00:49,880 --> 00:00:57,980 ‫to and accepts packets from the network layer, manages flow control and because it is meant to provide 10 00:00:58,010 --> 00:01:04,820 ‫error free data transmission handles retransmission of dropped or garbled packets, as well as acknowledgement 11 00:01:04,820 --> 00:01:06,410 ‫of all packets that arrive. 12 00:01:07,620 --> 00:01:12,960 ‫Let's see the connection oriented, error free communication of TCP and an example when a web server 13 00:01:12,960 --> 00:01:15,420 ‫sends an HTML file to a client. 14 00:01:16,110 --> 00:01:18,570 ‫It uses the HTTP protocol to do so. 15 00:01:19,410 --> 00:01:25,260 ‫The CDP program layer asks the TCP layer to set up the connection and send the file. 16 00:01:26,100 --> 00:01:32,970 ‫The TCP stack divides the file into packets, numbers them and then forwards them individually to the 17 00:01:32,970 --> 00:01:34,320 ‫IP layer for delivery. 18 00:01:34,440 --> 00:01:39,960 ‫Although each packet in the transmission will have the same source and destination IP addresses, packets 19 00:01:39,960 --> 00:01:42,090 ‫may be sent along multiple routes. 20 00:01:43,310 --> 00:01:49,820 ‫The TCP program layer in the client computer waits until all of the packets have arrived, then acknowledges 21 00:01:49,820 --> 00:01:56,690 ‫those it receives and asks for the retransmission on any it does not based on missing packet numbers, 22 00:01:57,560 --> 00:02:02,510 ‫then assembled him into a file and delivers the file to the receiving application. 23 00:02:03,520 --> 00:02:08,170 ‫The TCP Three-Way handshake is a method used by TCP to set up a connection. 24 00:02:08,950 --> 00:02:14,950 ‫He three three-way handshaking technique is often referred to as Sin Sinek Ach. 25 00:02:15,820 --> 00:02:22,270 ‫Because there are three messages transmitted by TCP to negotiate and started TCP session between two 26 00:02:22,270 --> 00:02:22,900 ‫computers. 27 00:02:24,050 --> 00:02:30,650 ‫This three way handshake process is also designed so that both ends can initiate and negotiate separate 28 00:02:30,650 --> 00:02:33,260 ‫TCP socket connections at the same time. 29 00:02:34,130 --> 00:02:37,370 ‫That means the connection is full duplex. 30 00:02:37,950 --> 00:02:38,440 ‫You know what? 31 00:02:38,450 --> 00:02:42,230 ‫We have to take a break at this point and talk about TCP flags. 32 00:02:43,770 --> 00:02:51,210 ‫There are one bit flags in TCP headers, which are called TCP flags, TCP flags are used within TCP 33 00:02:51,210 --> 00:02:57,180 ‫packet transfers to indicate a particular connection state or provide additional information. 34 00:02:58,330 --> 00:03:06,160 ‫Ignoring easy CW, R and an s flags for now, they're basically Six TCP flags. 35 00:03:07,670 --> 00:03:14,240 ‫The in or synchronization flag is used as a first step in establishing a three way handshake between 36 00:03:14,240 --> 00:03:14,960 ‫two hosts. 37 00:03:15,410 --> 00:03:20,120 ‫Only the first packet from both the sender and the receiver should have this flag set. 38 00:03:21,780 --> 00:03:27,540 ‫The act flag, which stands for acknowledgement, is used to acknowledge the successful receipt of a 39 00:03:27,540 --> 00:03:27,960 ‫packet. 40 00:03:29,150 --> 00:03:35,330 ‫The rest flag, which stands for Reset, get sent from receiver to the sender when a packet is sent 41 00:03:35,330 --> 00:03:36,630 ‫to a particular host. 42 00:03:36,650 --> 00:03:37,940 ‫That was not expecting it. 43 00:03:39,140 --> 00:03:44,600 ‫The Finn flag, which stands for finished means there is no more data from the sender. 44 00:03:44,630 --> 00:03:48,110 ‫Therefore, it is used in the last packet sent from the sender. 45 00:03:49,740 --> 00:03:56,460 ‫The peace flag, which stands for Bush, is somewhat similar to the U.S. flag and tells a receiver to 46 00:03:56,460 --> 00:04:00,350 ‫process these packets as they are received instead of buffering them. 47 00:04:01,840 --> 00:04:08,890 ‫The ARE flag is used to notify the receiver to process the urgent packets before processing all other 48 00:04:08,890 --> 00:04:09,430 ‫packets. 49 00:04:10,640 --> 00:04:17,210 ‫So every legitimate TCP connection begins with a DHCP Three-Way handshake, which is used to exchange 50 00:04:17,210 --> 00:04:23,150 ‫sequence numbers so that loss packets can be transmitted and packets can be placed in the proper order. 51 00:04:24,620 --> 00:04:31,970 ‫If Machina wants to initiate a connection to Machine B, it will start by sending a TCP packet with 52 00:04:31,970 --> 00:04:33,500 ‫a sin control bit set. 53 00:04:35,100 --> 00:04:42,900 ‫This packet will include an initial sequence number, which I'll call here is an A because it comes 54 00:04:42,900 --> 00:04:44,100 ‫from machinery. 55 00:04:45,090 --> 00:04:52,170 ‫Which is 32 bits long and typically generated in a pseudo random fashion by the DCP software on the 56 00:04:52,170 --> 00:04:52,590 ‫shiny. 57 00:04:53,500 --> 00:05:01,870 ‫The act, no, another 32 bits in the TCP header is typically set to zero because it is ignored in this 58 00:05:01,870 --> 00:05:02,650 ‫initial sin. 59 00:05:03,250 --> 00:05:09,430 ‫Some operating system variants may make this act no non-zero, but either way, it's ignored by the 60 00:05:09,430 --> 00:05:10,330 ‫destination machine. 61 00:05:11,900 --> 00:05:18,860 ‫So if the destination port is open, that is there is something listening on that board, it must respond 62 00:05:18,860 --> 00:05:26,900 ‫with a snack packet back a packet that has both the Senate and Act control bits set at the same time. 63 00:05:28,850 --> 00:05:36,020 ‫This packet will have a sequence number of ice and be a pseudo random number assigned by Machine B for 64 00:05:36,020 --> 00:05:36,820 ‫this connection. 65 00:05:39,070 --> 00:05:46,300 ‫The sinek packet will have an acknowledgement number of ES and a plus one indicating that Machine B 66 00:05:46,540 --> 00:05:49,000 ‫has acknowledged this in packet from Machine A. 67 00:05:50,230 --> 00:05:56,050 ‫To complete the three way handshake, Machina responds with an act packet which has a sequence number 68 00:05:56,050 --> 00:05:58,700 ‫of ESN a plus one. 69 00:05:59,320 --> 00:06:05,020 ‫It's the next packet, so the sequence number has to change from the value in the original sin packet. 70 00:06:06,520 --> 00:06:12,970 ‫The acknowledgment number field is set to and B plus one, thereby acknowledging the snack packet. 71 00:06:13,270 --> 00:06:13,570 ‫Right? 72 00:06:15,340 --> 00:06:22,240 ‫So we have now exchanged sequence numbers, all packets going from A to B will have increasing sequence 73 00:06:22,240 --> 00:06:29,710 ‫numbers starting at Ismay, plus one going up by value of one for each byte of data transmitted in the 74 00:06:29,710 --> 00:06:31,510 ‫payloads of eight B packets. 75 00:06:32,920 --> 00:06:35,470 ‫Likewise, all responses back from B. 76 00:06:35,950 --> 00:06:39,160 ‫We'll have sequence numbers starting again is and B plus one. 77 00:06:39,340 --> 00:06:42,010 ‫And going up for each byte of data from bit away. 78 00:06:42,790 --> 00:06:49,960 ‫In essence, we have two streams of sequence numbers in the series packets one from A to B, originally 79 00:06:49,960 --> 00:06:56,980 ‫based on Iceni and the other from B2, A originally based on IAC and B. 80 00:06:58,330 --> 00:06:58,750 ‫Perfect.