Lec-66: TCP connection Establishment and connection Termination | Transport layer
Lec-66: TCP connection Establishment and connection Termination | Transport layer
👉Subscribe to our new channel: / @varunainashots
TCP connection Establishment and connection Termination is explained in this video. TCP is a connection-oriented protocol and every connection-oriented protocol needs to establish a connection in order to reserve resources at both the communicating ends. A TCP connection is normally terminating using a special procedure where each side independently closes its end of the link. It normally begins with one of the application processes signalling to its TCP layer that the session is no longer needed.
Other subject-wise playlist Links: -------------------------------------------------------------------------------------------------------------------------------------- ►Design and Analysis of algorithms (DAA): • Design and Analysis of algorithms (DAA) ►Database Management System: • DBMS (Database Management system) Com… ► Theory of Computation • TOC(Theory of Computation) ►Artificial Intelligence: • Artificial Intelligence (Complete Pla… ►Computer Architecture: • Computer Organization and Architectur… ►Operating System: • Operating System (Complete Playlist) ►Structured Query Language (SQL): • Structured Query Language (SQL) ►Discrete Mathematics: • Discrete Mathematics ►Compiler Design: • Compiler Design (Complete Playlist) ►Number System: • Number system ►Cloud Computing \u0026 BIG Data: • Cloud Computing \u0026 BIG Data ►Software Engineering: • Software Engineering ►Data Structure: • Data Structure ►Graph Theory: • Graph Theory ►Programming in C: • C Programming ►Digital Logic: • Digital Logic(Complete Playlist)
--------------------------------------------------------------------------------------------------------------------------------------- Our social media Links: ► Subscribe to us on YouTube: / gatesmashers ►Subscribe to our new channel: / @varunainashots ► Like our page on Facebook: https://www.facebook.com/gatesmashers ► Follow us on Instagram: https://www.instagram.com/gate.smashers ► Follow us on Instagram: https://www.instagram.com/varunainashots ► Follow us on Telegram: https://t.me/gatesmashersofficial ► Follow us on Threads: https://www.threads.net/@gate.smashers -------------------------------------------------------------------------------------------------------------------------------------- ►For Any Query, Suggestion or notes contribution: Email us at: [email protected] #TCPConnection #ConnectionEstablishment #ConnectionTermination #GATE #UGCNET #PSU
Content
0.059 -> - Hello friends, welcome to Gate Smashers. The topic is TCP connection establishment
4.09 -> - like we saw in the video, whenever we send data through TCP
10.004 -> - first TCP establishes the connection. We generally call this connection establishment as three-way hand shaking method
17.009 -> - we will discuss about 3-way hand shaking method properly in this video, that how TCP
22.049 -> - establishes connection. And what values it sends
26.071 -> - between the sender and receiver. So firstly here we're talking about TCP
31.033 -> - In TCP, firstly what is the connection establishment
37.013 -> - if A is establishing connection with B, A is sending it's information to B
42.048 -> - and it's telling B to reserve some things, means to fix some things like buffer, CPU
50.046 -> - bandwidth. Reserve them because after that A will send message to B
55.065 -> - and B will also send some information to A, it will send information to make connection, and will tell A to reserve buffer
64.094 -> - CPU, bandwidth, so that connection establishes properly
69.029 -> - it just like telephone network. TCP always works like telephone network, like we talk to someone
76.006 -> - there is first dial-up. Dial-up is what? It is a connection establishment phase
80.049 -> - such that once the connection is established, after that my packets
84.085 -> - means the data is properly sent by two way communication
89.017 -> - that is called as reliability also. Reliability means there shouldn't be loss of my packets
95.025 -> - there shouldn't be data loss. In case there is data loss, then re-transmission should be there
100.073 -> - so that's why wherever we need reliability, there we will use TCP only
106.035 -> - so that's why TCP is majorly used protocol because whenever we need the reliability
111.083 -> - whenever we need the 100% guarantee to reach the packet, then definitely we have to use the TCP
118.008 -> - so we're talking about TCP connection, here I have a client machine
122.031 -> - and a server machine. Generally we use TCP at the time of client server communication, where client machine
129.03 -> - like my laptop it can work as a client machine, and if I am accessing a service or web server like Google
137.049 -> - Google is working like a server
140.058 -> - and my machine is working like a client. Means, from my machine to some other machine
146.05 -> - data is being transmitted. And the 2nd important point that we discussed is that TCP works in full duplex. Full duplex means
155.02 -> - client is sending data to the server, and server can also send data to the client. That is called a
160.089 -> - full duplex mode. Means if A and B are communicating with each other, then the communication will be in two way
168.061 -> - now, here I have two machines client and server. So what is the first point, let say, from my system
175.041 -> - I have opened a web browser. I opened the browser, after opening the browser operating system will assign a port number to me
183.06 -> - but these port number always aren't from the well known port numbers
188.046 -> - some ports are registered with IANA. The port number that I'll get
195.017 -> - that port number is nearly about 50000 to 65000 range
201.025 -> - and that port number is assigned by operating system
204.069 -> - now I am transmitting a message from my port number, that is the first message to establish the connection
212.097 -> - means it's not transmitting the data, this is not the data. We will transmit the data afterwards
217.033 -> - the first packet/segment we're sending, this segment is for connection establishment
224.093 -> - so here my machine is active open phase. Active open means,
229.057 -> - I'm ready, I'm ready to make the connection. First, the client should be ready.
234.009 -> - Because the servers are running 24×7.
238.014 -> - Google won't tell you ever to make connection with it. I've to make the connection first
243.088 -> - So my machine is active
246.073 -> - packet will be sent from my machine. The diagram which you can see here, this diagram is actually a header
253.076 -> - I discussed about TCP header in last video that what are the values, what are the uses
259.049 -> - you can check that video again, it will become properly clear by that
263.061 -> - otherwise you can pay attention here properly, I'll tell you what are the values and what are their particular use
271.011 -> - so first of all I've written here source port number. Source port number of my machine is A
276.038 -> - and destination port number is 80. Because whenever we access the web pages
281.037 -> - web pages are always accessed on 80 number port. So we can write the port number like 80
287.009 -> - important point here is sequence number, means
290.081 -> - as the client sends the message, it will always use a sequence number, means
296.014 -> - this sequence number is used by it, it's a number, it's always a randomly generated number, it's never from 0
303.006 -> - if all the machine starts from 0, then all the machines will use it's sequence number 0
308.074 -> - so that's why we use random sequence number here, value of which can be from 0 to 2³² -1
316.074 -> - which is a very huge number. So here a sender/client sent 9000
323.043 -> - I generated a simple number randomly and sent it. Along with that, Sync flag
330.084 -> - made the sync flag value 1. Sync flag means, I want to synchronise with the server
336.063 -> - means I want to make a connection with the server. So I made the sync flag 1
342.09 -> - this is what, a flag width, value of which is of 1 bit. It's value can be either 0 or 1
348.044 -> - so I'm sending it after activating
352.002 -> - along with that, window size, window size means 12000, 12000 is what? It is a byte
357.059 -> - Means client is sending the size of it's window, that the size of my window is
364.002 -> - 12000 byte. This is a very important point here that why we use window size? For flow control
370.052 -> - and the sender/client sent the size of it's window, means, the size of it's buffer
377.026 -> - that my buffer can accept maximum 12000 byte
383.089 -> - that is the client's receiving end. Means, client told it's receiving capacity by itself
391.04 -> - it advertised it itself that don't send me data more than this
396.001 -> - other than that, options and padding. The last option we've in options and padding
401.015 -> - in that it told MSS. MSS means, Maximum Segment Size
406.013 -> - maximum segment size is 1200 byte. Now what is a maximum segment size?
411.061 -> - whenever we use a connection, then at data link layer, means, whenever my connection will go down from TCP to network layer
419.099 -> - and then to data link layer. So at data link layer we generally use Ethernet.
424.055 -> - and maximum segments in Ethernet, means, size of one packet should be less than 1500 byte
432.07 -> - if you mentioned your window size as 12000 byte
436.046 -> - it is simple, like I have said that I can accept data of maximum 12000 byte
443.094 -> - then it may be possible that server sends only one segment of 12000 byte
448.09 -> - but my network doesn't support only one packet of 12000 byte
457.061 -> - it can support small packets, together which makes 12000, but it is not necessary that my only one packet is of 12000 byte
466.066 -> - that means my maximum capacity is of 12000 byte
471.041 -> - but size of one packet is 1200, so send me 10 packets of 1200
478.046 -> - so that my window will be full. In this way client is telling the server indirectly that it should be of 1200 byte
487.018 -> - if one packet is of 1200 byte and if you will send 10 packet from that type then my window will be full
494.056 -> - my window means my buffer will be full
499.032 -> - now this message/full information is sent by client to the server. Server is on passive open mode. Means,
507.058 -> - server is running 24×7. It's open
510.073 -> - but it is in passive mode, because client has just sent a request
514.09 -> - server will store this all information at its own end, and then it will generate a packet
521.006 -> - it will also generate a acknowledgement
524.01 -> - that's why we call this, when first information is sent, we call it sync
529.029 -> - because we're trying to just synchronise with the server
532.087 -> - but the server is sending us sync+acknowledgement
536.046 -> - because it's full duplex. Server will also send it's information to the client, dad this is my capacity
542.057 -> - this is the size of my MSS + acknowledgement, that your packet has been received
547.026 -> - I am sending you the acknowledgement also and my information along with that
552.044 -> - now the server which was in passive mode will come in active mode. But before coming in active mode it sent it's information
560.084 -> - that ok my port number is 80, and this is your port number, and sequence number is 3000, means
567.073 -> - now the server which is sending data is using sequence number 3000
575.048 -> - means now whenever the server will send data, it will send after 3000
581.042 -> - so that client gets to know that my data will now start coming from 3000
587.053 -> - means, these all are bytes. Because it is a byte streaming protocol. Every byte here is counted as a number
594.042 -> - so the server also told it's sequence number, it is also a randomly generated sequence number and acknowledgement
602.053 -> - we've already discussed acknowledgement. It is always x+1, means
607.037 -> - if client has sent 9000
610.078 -> - then receiver/server will send 9000+1, that is 9001
616.046 -> - which is the next expected byte, because this 9000
621.076 -> - this number 9000 has been used. It won't be used again for the data
627.022 -> - because we have used 1 byte just to synchronise
632.049 -> - now, the service sending that I have received your 9000
637.051 -> - now start me sending from 9001
642.057 -> - along with that it made the acknowledgement flag to 1, means
646.052 -> - now my packet is also doing acknowledgement
649.059 -> - this is the acknowledgement
651.029 -> - I'm acknowledging that I have received your 9000, now start me sending from 9001
658.073 -> - along with that, sync, sync means, server also wants to receive some data
663.098 -> - Server also wants to get some data share some data
667.066 -> - it's working in full duplex mode, so server also made it's sync flag to 1
672.071 -> - along with that it also advertised it's window size. Means, it's buffer
678.061 -> - can accept maximum 18000 byte
684.031 -> - but MSS, MSS is again important, because
688.029 -> - the network at it's end, that network/buffer accept maximum of 18000 byte
697.033 -> - but in that network the size of one packet should be, it mentioned it as 600 byte
703.077 -> - so that means simply calculate, that 18000÷600, so which is
711.034 -> - 30
712.041 -> - means server is telling the client that you can send me up to a maximum of 18000 byte, not more than that otherwise there won't be flow control
722.079 -> - for flow control server said that 18000 byte should be maximum
727.039 -> - but don't send one packet of 18000 byte
730.093 -> - you can send maximum 30 packets of 600 byte, then my window will be full
738.018 -> - it did it's advertisement and also told it's maximum segment size i.e.600 byte
746.001 -> - this packet will be received by the client. So it is two way
750.064 -> - but this is a three way communication. Now the client will again send the data and sequence number used here is
758.044 -> - 9001. 9001 means,
762.002 -> - I would like to tell you a point here, you can find this in many books or in some online material you can find 9000 here
769.037 -> - because the sequence number we're writing here, we already wasted a sequence number here
776.031 -> - means it is not a kind of waste, but we have used one sequence number just to make the connection
782.065 -> - we used that sequence number. So you can also write 9000 here
788.02 -> - but I am not writing 9000 here because the server is expecting 9001
796.038 -> - then why should I write 9000. When I was expecting 9001 then definitely I will write 9001
803.054 -> - but important point here is, this 9001 sequence number isn't wasted
809.059 -> - when you will start transmitting data after that, this number can be re-used
815.083 -> - you can use this sequence number again for data transfer
820.021 -> - but you can't use this, it's already utilised
823.078 -> - so that's why I have written 9001 here, because when server is expecting 9001
828.082 -> - then why should I write 9000. So it sent 9001
833.056 -> - along with that there's acknowledgement. Server sent it's sequence number 3001
838.062 -> - 3000, sorry. So the client is sending 3001 here
843.042 -> - means your 3000 sequence number has been accepted. Now, start transmitting data from 3001
852.089 -> - that is a next expected byte. Along with that ACK
857.005 -> - it made acknowledgement flag to 1 because it is again a acknowledgement
861.036 -> - it is acknowledgement what is received from the server. So if you see this in generic form, first is synchronise
869.094 -> - packet is sent then after, synchronise+acknowledgement, both the things
875.008 -> - synchronisation is already there and plus acknowledgement is also there
879.049 -> - and in 3rd we only sent acknowledgement
882.064 -> - that the data which was sent by the server is properly acknowledged/saved
887.088 -> - accept acknowledgement from my side
890.073 -> - now the data can be transferred further
894.036 -> - after that the data will start transferring. So this is the three way handshaking method
901.044 -> - so this is all about the three way handshaking connection establishment by TCP
906.02 -> - so if you liked the video, please share it with your friends
909.003 -> - and please subscribe my channel, thank you.