Loading

Module 1: Transport Layer

Notes
Study Reminders
Support
Text Version

Transport Layer: Connection Release

Set your study reminders

We will email you at these times to remind you to study.
  • Monday

    -

    7am

    +

    Tuesday

    -

    7am

    +

    Wednesday

    -

    7am

    +

    Thursday

    -

    7am

    +

    Friday

    -

    7am

    +

    Saturday

    -

    7am

    +

    Sunday

    -

    7am

    +

Transport Layer: Connection Release
Welcome, back to the course on Computer Network and Internet Protocol. So, we arelooking into the transport layer and the connection establishment mechanism in thetransport layer. So, in the last class we have seen that well whenever you are setting up alogical connection between 2 end host of a network, the challenge is the delayedduplicate packets.(Refer Slide Time: 00:52)So, the delayed duplicate packets may create a confusion like during the connectionestablishment phase that whether the packet that you are being received, say if you havereceived the delayed duplicate message, whether that delayed duplicate message is or inother words if I say it more clearly like whenever you receive a duplicate message, youdo not be sure or duplicate connection establishment request you cannot be sure whetherthat duplicate message is a delayed duplicate of the earlier one or the client has crashedand it has re-initiated the connection with the server and that connection request messageis coming from that one.So, what we have looked till now that will the way we can mitigate this problem is byutilizing a virtual clocking mechanism with the help of sequence number, where we areutilizing the concept of byte sequence number that every byte in the network will have aunique sequence number. And during the connection establishment phase, we need togenerate the sequence number in such a way so, that the other end like here in theexampled a server can correctly identify from a duplicate message that whether thisduplicate connection request is the delayed duplicate of the old connection request or it isa new connection request after the client has crashed.So, to do that it can look into the sequence number field and it can find it out, but weneed to ensure here that this connection request sequence number, the initial sequencenumber that has been utilized for connection request, it is not going to re-use within atime duration T which is the maximum packet life time in the network. So, you need toensure that with this time out duration T, every instances of a segment or here we areusing byte sequence number. So, every instances of a byte with the sequence number isonly one such instances outstanding in the network. There are not more than oneinstances of the same byte in the network, same byte means the byte with the samesequence number in the network which can create confusion for the other end, for thereceiver.(Refer Slide Time: 03:09)So, we are looking into this problem from the context of this forbidden region. So, whatwe see that whenever connection 1 connection selects one sequence number - so thisparticular dark black line indicates, so this line indicates the sequence number that aparticular connection is going to use with the respect of time. Now, if it is using this setof sequence numbers, so every byte with that sequence number they have a life time herethis life time is T. So, within that life time the packet or the byte can be outstanding inthe network.Now, in a scenario when this connection is being crashed and you want to initializeanother connection during that time, if this region of the old connection and theforbidden region, so this region we call as the forbidden region. So, the forbidden regionof the old connection and the forbidden region of the new connection, if that getsoverlapped then there is a there may be a problem of confusion. Why? Because at thistime instance, you have you may have two different instances of the same sequencenumber in the network. So, one sequence number is from the old connection anothersequence number is from the new connection. So, you can have one sequence numberfrom this old connection another sequence number from this new connection and wewant to avoid that. Now, to avoid that, the solution mechanism that we can employ issomething like this, like either you make it separate with respect to time.(Refer Slide Time: 04:48)That means, you wait for some amount of time before initializing the new connectionsuch that you become ensured that this particular sequence number which was there saythis sequence number it was completely gone out of the network. So, it is like that thisthe same sequence number which was there for this connection 1, that sequence numberhad a lifetime up to here. So, that sequence number is out from the network and thatcannot create a confusion anymore.So, you wait for certain duration. So, here this is the wait duration and then you initiatewith say this is the wait duration. So you wait for this wait duration and then initiate thisnew connection such that this forbidden region does not overlap with each other. So, ifthis forbidden region do not overlap with each other, you will be sure that, there isalways a single instances of a particular sequence number outstanding in the network.that is one way by shifting the connection in the time scale.(Refer Slide Time: 06:18)Another way is to shift the connection another way is to shift the connection in the in thesequence number scale. So, you use the sequence number which is high enough of thesequence number that was utilized for connection 1. So, that you became sure that wellthe sequence number field that you are going to use for connection 2 that does not have aoverlap with connection 1.So, here we are utilizing this space. So, we are we are making a gap in the sequencenumber, such that we become sure that whatever sequence number that we are going touse, that particular sequence number has not been used by connection 1. So, this are twofeasible way of setting the initial sequence number in the network.(Refer Slide Time: 07:11)Now, let us see that how you can handle the delayed duplicates during the connectionestablishment by mitigating this two problem. So, if we ensure this kind of things nowwhen a receiver receives two segments having the same sequence number within a timeduration T, the receiver knows that one packet must be the duplicate. Say it happens thatwell the sequence so, you are always ensuring that within that time duration T, thereceiver cannot receive a packet cannot receives a two different packets with the samesequence number or two different bytes with the same sequence number. Now, if thereceiver is receiving two different bytes with the same sequence number with theduration T then the receiver can correctly decode that the second one is the delayedduplicate of the first one or the visa versa anything can happen and but you can you inthat case the receiver can accept one and can discard the second one that it has received.(Refer Slide Time: 08:23)Now, for a crashed device, then the transport entity that remains idle for a duration T, ifyou are just utilizing this time scale, at time period based sequence numbering to ensurethat all the packets from the previous connection are dead. So, here actually we areutilizing the first solution that I was mentioning that you wait in the time scale andensure that by that time all the instances of the previous sequence number is dead fromthe network.So, whenever you are going to use a sequence number there is no possibility that thereare two bytes with the same sequence numbers are outstanding in the network, but this isnot a good solution because you have to wait for certain amount of duration. So, for thatyou can also choose the sequence number in such a way we will see that in the context ofthe TCP that you can choose the sequence number in such a way, so that you aresignificantly high above the forbidden region of the previous one and you can be surethat the sequence number has not been utilized by the previous connection, forconnection establishment.(Refer Slide Time: 09:34)Now, the solution here is you adjust a initial sequence number properly; that means, ahost does not restart with the sequence number in the forbidden region based on thesequence number it used before crash and at the time duration T. So, it is just like that ifthe if you have if the system has crashed then whenever whatever sequence number wasthere, the new sequence number that you are going to generate, you generate in such away, so that is above the previous sequence number. So, we will see that how we cangenerate this particular sequence number.(Refer Slide Time: 10:12)Now, there can be two different source of problems. Whenever there are two connectionslike whenever one connection has crashed and another connection is going to going touse a initial sequence number field. So, let me just give you one example here. So, it isjust like that one connection it has used this sequence number and then it got crashed andthis is the forbidden region for this old connection, say I name it as connection 1.Now, say there is a second connection. The second connection is starts from here withthe initial sequence number. Now, if the second connection starts from here with theinitial sequence number and follow this line the sequence number space, then this wouldbe the forbidden region, there is no overlap my life is happy. But if this particular newconnection starts sending data at a very fast rate, so if it follows this line rather than thedotted line that I have drawn earlier, then you see that these becomes the forbiddenregion and here for some packets you have a overlap. So, you have certain overlap herein this region.So, in this region there can be still the confusion about the sequence number wheneveryou will receive a packet whether the packet belongs to connection 1 or this newconnection, connection 2 so, if if you increase the sequence number space too fast thenthat can become a problem. So, that is why the sequence number need to be increased ata constant rate or at a bounded rate. So, that the sequence number space or this increaseof the sequence number for the new connection does not overshoot the sequence numberspace of the previous connection. So, that they do not overlap with each other.(Refer Slide Time: 12:33)Another problem is there for selecting this initial sequence number that the data rate istoo slow. If the data rate is too slow like in this example say the initial sequence numberwas used like this then the data rate was too slow. So, it started generating the initialsequence number at a very slow rate and after that it crashed and the new system it juststart using this initial rate that say if I name it as connection 1, that connection 1 used andthis one as connection 2 that connection was 1 used then again there is a possibility ofhaving a overlap hereSo, how will you do that? So, you can do that that you can bound the maximum data ratethat you can sale over a transport protocol. So, the maximum data rate on any connectionwe bound it as one segment per clock tick. So, here we used the hardware clock, but onlythe hardware clock of my machine. So, here we will see that we do not require thesynchronization of the hardware clock across multiple machine. So, the hardware clockof a single machine will serve my purpose.So, with every hardware clock tick so, the clock tick is the inter packet transmissionduration the clock ticks is adjusted based on the sequences that is acknowledged. So,TCP uses this concept of self clocking or a virtual mechanism that whenever youreceived an acknowledgement. So, this is something like a mix of the connectionestablishment under flow control mechanism for handling the sequence number spacethat whenever you are receiving an acknowledgement, during that time you make a tickthat you generate new packet or new segment with a new sequence number.So, you ensure that the no two packets are there in the network with the same sequencenumber. So, this also ensures that the sequence number space that do not wrap aroundtoo quickly. So, you have a finite sequence number space in case of TCP kind ofprotocol, you have 32 bit sequence number. Now, if you have a 32 bit sequence numberthen you can used to 2 to the power 32 different sequence numbers. So, you need toensure that this entire sequence number speed does not wrap around too quickly.So that means, if you are sending data at a very high rate it may happen that you aregenerating the data in such a rate that you have within that time duration T or evenbefore the time duration T you have finished this entire 32 bit of sequence number space.So, that may create a confusion, because that may create a confusion. So, you want toprevent that and to prevent that you want to regulate the sender flow as well apart fromthe receiver flow. Normally with the flow control algorithm, we coordinate betweenthese sender flow and receiver flow but whenever we are generating the sender packetsyou also want to ensure that the packets which are being generated from the sender theyfollow certain kind of I will not say it is a constant rate rather they are in within abounded rate.So, that is why the application is generating data as its own rate and the data is beingbuffered at the transport layer buffer and the transport layer picks up the packets fromthere, picks up the bytes from the there and generate the segments with a predefinedbounded rate. So, that the sequence number space does not get overlapped with eachother. So, let us look into how this three way handshaking works. So, whenever host 1 issending a connection request message. Host 1 sends the sequence number value x, so,here host 1 sends the sequence number value x and host 2, it sends back with anacknowledgement. With the acknowledgement it also puts that sequence number x and italso. So, in case of transport layer normally our connections are bi directional becausethe connections are bi directional with this particular acknowledgement, the host 2 alsosends another acknowledgement, sends another sequence number it for reverseconnection from host 2 to host 1 that is the sequence number y.Now, whenever the host 1 receives an acknowledgement with sequence number x host 1can verify whether this sequence number which was there in the acknowledgement it isthe original sequence number or not it is the sequence number of the connection requestmessage that is sent it is corresponding to that or not. If it is OK, then it can send the datawith that sequence number x and at the same time it can also send acknowledgement forthe sequence number space or the sequence number that was proposed by host 2 for host2 to host 1 data transfer. So, this three way handshaking ensures that their all the delayedduplicates are correctly identified by both host 1 and host 2. So, let us see that how withthis mechanism they can correctly identify delayed duplicate of the sequence numbers.
Transport Layer: Connection Release - Part 2
So, let us see a case when the connection request is a delayed duplicate. Now, if theconnection request is a delayed duplicate so, the host 2 has received the delayedduplicate connection request with the sequence number x. So, it sends back with anacknowledgment of that x. Now, host 1 can verify that this particular acknowledgementthat it has received it is not for a connection request that it has sent. So, that connectionrequest was a old duplicate that it has sent long back and now host 1 do not want to usethat connection anymore, maybe host 1 has crashed here and then it got and restartedhere, then it got restarted here. So, it do not want to use that old connection request that ithas requested earlier.So, host 1 can find it out and if it finds out that this acknowledgement is aacknowledgement a sequence number field which is there in acknowledgement messageit is for a delayed duplicate, then it can send a reject message. By looking into the rejectmessage, host 2 can identify that the connection request that was sent that it was receivedit is not going to be accepted by host 1 anymore. So, there is no point in establishing theconnection.(Refer Slide Time: 20:27)Now, let us look into another case when both the connection request and theacknowledgement are delayed duplicates. Now, when the connection request is a delayedduplicate and host 2 sends back an acknowledgement here with this sequence number xwhich it was received as a part of the connection request message and it proposed with anew sequence number y during that time it gets a reject message. But for the oldduplicate that it has sent, say it has received one acknowledgement here, thisacknowledgement says that it is a sequence number for x, but the acknowledgementnumber says that well the acknowledgement number is z.Now, if you look into this three way handshaking mechanism these acknowledgementnumbers should corresponds to the acknowledgement number should corresponds to thesequence number that was proposed by host 2 in it is acknowledgement. Now, these twoare not matching. So, host 2 will reject this duplicate acknowledgement. At the sametime, host 1 whenever it has received this acknowledgement message and it finds out thatit do not want to use this acknowledgement anymore because it has crashed here and sayrestarted here, then it can sends the reject message.So, with this way you can identify that both the connection request was a delayedduplicate that was identified by host 1 and it sends a reject message and host 2 wheneverWell so, that was the all about the connection establishment. So, what we have broadlyseen here just to give you a summary of the entire procedure, the connection requesting,so what we have seen that because packets can get dropped in a packet switchingnetwork, there can be arbitrarily delay in transferring the packet, there can be lossbecause of this reason, there is always a possibility of having a delayed duplicate.Now, what we have learned till now that my major problem is to select the initialsequence number for connection establishment. Once this initial sequence number isestablished, then the flow control algorithm takes care of maintaining the sequencenumber for the data pack is that will look later on that how flow control algorithmactually helps you to set up the sequence number for the data packets or the datasegments in the context of the transport layer.But, the challenge here is to select a initial connection request request in such a way, sothat you can ensure that the forbidden region of a new connection does not get overlapfrom with the forbidden region of an older connection. Where both the new connectionand older connection are initiated on the same application at the same source destinationpair. So, they are likely to use the same port. So, in that case our objective is to separateout a normal connection request from a delayed duplicate connection request and in thatcase we take the help of a sequence number.Now, we have looked into that how to chose a initial sequence number, but wheneveryou are choosing the initial sequence number you have to ensure that well your initialsequence the sequence number field does not increase too fast or too slow such that itgets overlapped with another connection. In that particular context this rate of control ofsequence number that is taken care of by the flow control algorithm and we ensure thatwell the packets are generated or the bytes are not, I will not say generated that thetransport layer transmits the byte transfers the byte in such a rate, so that it is not tooslow or not too fast all the connections follow almost a bounded rate.But, whenever you are selecting the initial sequence number, you can use this three wayhandshake mechanism for selecting the initial sequence number such that such that evenif your connection request is the delayed duplicate or the connection request or thecorresponding acknowledgement is the delayed duplicate you will be able to differentiatebetween the old connection and the new connection, by ensuring that the sequencenumbers are not generated from the forbidden range of the previous connection. And youare making sure that no two bytes in the networks are having same sequence numberbetween the same source destination pair coming from the same application at the sametime instance.Now, let us look into the connection release. Connection release is little bit easiercompared to connection establishment because we do not have the problem of sequencenumber here, but here we have a different problem. So, there can be two type ofconnection release, so one we called as a asymmetric release. So, the asymmetric releasesays that when one party hangs up the connection is broken. Now, it is just like thatwhenever host 1 is ready to or whenever host 1 is done transferring the data, host 1breaks the connection. Say it may happen that host 2 now wants to wants to close theconnection, host 2 simply sends the connection release message. So, here it is DR datarelease message, host 2 sends the data release message and host 2 goes to sleep.Now, even if host 1 has some data to send to host 2 that particular data if any host 1 sentit, host 2 may not be able to receive that data. So, there would be a possibility of dataloss with this concept of asymmetric release.So, we map this protocol in the context of a problem called two army problem. So, wehave a white army which is there in a valley and the blue army which was there in thehill now you see that the total total fighters in the blue army it is more than the whitearmy, but they are separated now, they are in the two part of the hill. So, they need tocommunicate with each other to make sure that both of them attack simultaneously; bothof them are able to attack simultaneously then they only they will be able to defeat thewhite army otherwise they will be not able to defeat.Now, the problem here is that if the blue army wants to send a message called attack, thisblue army 1 wants to send that message to blue army 2 they have to go back the valleywhich is the vulnerable position. So, it may always happen that one soldier of white armyis able to see that the soldier of the blue army and kill that person and the message is notdelivered in the other way. So, the environment is unreliable.Now, whenever the environment is unreliable you can see that you will never be able tomake a protocol, correct protocol to solve this particular problem that both the blue armywill come into consensus and they will be able to attack the white army simultaneouslybecause whenever you are you are sending one soldier of blue army via this valley, bluearmy 2 is may not get that particular soldier, message from that particular soldier andthey will not be able to sure that whether to make an attack or what is the currentcondition. So, we cannot have one protocol to solve this particular problem. So, in thiscase the best way you can do is that let every party take their own independent decisions.Then say this particular data release message from host 2 got lost. So, if this data releasemessage from host 2 got lost, so here host 1 has sent a data release message with host 2received and host 2 has sent another data release message. So, host 1 will get a timeout,after it will get a timeout it will again send the data release message. So, once it sendinga data release message host 2 will receive that message it will again start the timer sendthe data release message. So, once it is it is getting these data release message it willrelease the connection, send the acknowledgement and once host 2 will get thatacknowledgement, it will release the connection.(Refer Slide Time: 32:10)Now, let us see another scenario when both the data release and the acknowledgementare lost. So, here this data release is lost and as well as the acknowledgement is lost. Inthis case so, if both this messages are getting lost then both the node will wait for atimeout value. So, here you can specify that host 1 it will try for N different timeouts andonce this N T different timeout occurs it will release the connection and host 2 it willwait for similarly for the timeout value once the timeout occurs it will release theconnection.So, here we are we are basically making the protocol from a asymmetric view that wewill wait for certain timeouts and if you are not able to solve the problem with thattimeout value then you independently release the connection, but as we have seen earlierin case of asymmetric connection there is always a possibility of having a data loss. So,this particular lecture it has given you the idea about the fast services, fast of the serviceswhich is being supported by the transport layer of the protocol stack, where we need toestablish the connection between two remote host which is a kind of logical pipe toestablish the hello messages between two end and because of this reliability problem inthe network, we see that ensuring the connection establishment is a challenge. You canyou can argue that well I have the reliability protocol then why should I bother about allthis difficulties during this connection establishment.But, you remember that the reliability only comes that when you have set up this initialsequence number. So, then you can apply your flow control and the reliability protocolwhich will look later on we call them as the automated request protocol ARQ protocol.So, this ARQ protocol they can take care of the loss by retransmitting the packet becausethey have a reference frame through which you can it can utilize the sequence numberfield.But, whenever you are setting up the initial connection during that time you do not haveany initial reference frame, like from where you will start the sequence number. If everyconnection starts from sequence number 0 then that can be a problem because of thatforbidden region concept that we have looked at here.Now, to solve this particular problem we have seen that well, by utilizing this selfclocking mechanism through the hardware clock or by clocking from theacknowledgement you can generate the sequence number fields ensuring that thesequence number of a connection for the same source destination pairs with the sameport they do not overlap with each other. And at the same time, you are ensuring thesequence number in such a way, it should be higher enough from the previous sequencenumber, so that they do not get overlap and finally, once this sequence number isestablished to this three way handshaking mechanism and, during that time you haveseen that if there is a loss or a delayed duplicate of the messages, the other ends will beable to correctly decode that.In the context of connection release you have seen that well symmetric release is a goodoption - asymmetric release is a good option, but you cannot design a protocol forasymmetric release in a in a unreliable channel. So, that is why we go for a symmetricrelease with the timeout value. So, you will try to make a symmetric release, if you arenot able to do that within certain number of timeout then you forcefully close theconnection. There is always a possibility of data loss, but as I have mentioned earlierthere is always a trade off between the performance and the correctness. So, here we arenot going for a protocol which will be completely correct. There can be certain amountof data loss always due to this symmetric release mechanism. But, our target is tominimize it as much as possible by utilizing that timeout value. The timeout ensures thatwhatever packet that has been sent by the other end, that will reach at the destinationwithin that timeout value.So, that is all about the connection establishment and connection release. In the nextclass we will look into another service in the transport layer. So, thank you all forattending the course.