Transport Layer: Connection
Welcome back to the course on Computer Networks and Internet Protocol. So, we arelooking into the different functionalities of the Transport Layer of the protocol stack andin the last class we have looked into that what different services the transport layer canprovide on top of your unreliable datagram delivery that is supported by the networklayer. And what we have seen that the packet delivery, the end to end packet delivery atthe network layer is unreliable, and the transport layer provide certain end to end serviceson top of that. So, from today onwards we look into the details of all those serviceswhich are being provided by the transport layer.(Refer Slide Time: 01:00)So, the first service that we are going to talk about is about the connection establishment.So, as we are looking or discussing in the last class, that the two end of the deviceswhich has the entire 5 layers of the protocol stack, so the two end need to first setup alogical connection between themselves. And this logical connection is something likethat one person is saying about hello and another person is replying back with anotherhello message. And they are they establish a logical link among themself and they bothof them become sure that they want to share the further information among themselves.So this connection establishment is to see that whether the other end of thecommunication is live or not whether that is ready to receive the message or not. And ifit is ready to receive the message, if it acknowledges then we can safely start sending thedata. So, in case of your voice network like the telephone network, you can just do it bysaying hello. Because you know that it is a circuit switching network and whenever youare saying hello, the packet will always or your message with always reach at the otherend. The reliability is not a issue there.But in case of a data packet switching network, this reliability is an issue, because thisentire packet switching network is working on the basis of king principle where as I wasmentioning the last class that every intermediate devices has certain fixed amount ofbuffer and whenever you are putting certain packets into that or certain data into that andif your network load is too high, it may happen that the buffer becomes full and packetstarts getting dropped from that buffer. If it happens, then it becomes difficult for you tounderstand or to ensure that whenever you are saying hello, whether that message iscorrectly being received by the other end or the second scenario can be like the other endis not ready to receive your message and that is why it is not echoing back the hellomessage or not acknowledging your hello message.So, that is why ensuring this logical connection at a packet switching network, for datadelivery, is little bit non-trivial compare to what is being used in case of your traditionalcircuit switching network or in the telephone network. So, we will look into the differentaspects of this connection establishment, in the context of transport layer of the TCP/IPprotocol stack, that how you can ensure that whatever hello message you are transferringto the other end, the other end is correctly receiving that hello message and correctlybeing able to decode that hello message. And it is able to send you back with the requiredreply.So, let us look into the connection establishment in details. So, the connection is just likea logical pipe that ensures that both the ends are now ready to send or receive furthermessages or further data.So let us see a very naive protocol of the connection establishment. So, we have in a weare in a client server model. So in this client server model, the client is trying to make aconnection with the server.So, we say that the server is in a listen state, the server is listening for the incomingconnection. So the client sends a connection request message. So, once the client sendthe connection request message the sever is in the listen state. So the server can listenthat connection request message and it replies back with the connectionacknowledgement message. So this 2 way hand shaking is likely to work for a normalconnection establishment purpose, but our life is not very simple in case of a packetswitching network.So, the question is that this simple primitive where the client sends a connection requestmessage and the server responses back with the connection acknowledgement message.Just like the hello protocol that we use in case of our telephone network, whether thatwill work in the case of packet switching network or data network or not.Now, the problem in the packet switching network is that, the network can lose thepacket, there can be packet loss from the network; there can be arbitrarily delay indelivering the packet. There can be delay in delivery the packet because it may happenthat the intermediate router switch are there, that intermediate routers their buffer isalmost full and it is receiving packets from multiple other links and it need to transfer thepacket one after another.So, just like a scenario in a road congestion. So, whenever a road become congested thenthe speed of the cars becomes very slow. And all the cars are going to enter to a commonroad from multiple others road and in the road junction because it has a finite capacity,that becomes the bottleneck and the congestion becomes there, because of which thespeed of individual cars become very slow.The same thing can happen in a computer network because a router is receiving packetsfrom multiple other neighboring routers and when it happens, it may it may result in acongestion in the network, because of which the rate of packet becomes very slow. Andthat is why there can be this kind of arbitrary delay in the network. The packet can getcorrupted as well and there is a possibility of duplicate packet delivery. Because thetransport layer also ensures reliability and the way of ensuring reliability in the transportlayer is just like to monitor whether a packet is being received by the other end or not. Ifthe packet is being received then I am happy, if the packet is not being received, if I amable to find out that the packet is not being received, then what I will do that I willreturns with the packet after a time out.Now, it may happen in the network that well the earlier packet that I have transferred,that packet got stuck somewhere in some intermediate queue in the network because ofthe congestion or this kind of network effect. And I am keep on waiting for theacknowledgement and I do not get the acknowledgement within that timeout duration.So, I think that well the packet is probably got lost and then I retransmit the packet again,but whenever I am retransmitting the packet again note that the earlier packet wasactually not lost rather the earlier packet was just waiting in a queue to get it delivered.So, because of this reason it may happen that well the other end the receiver may receivemultiple packets of the multiple or better to say multiple copies of the same packet whichwe call as a duplicate packets. Now, when it happens, you can think of scenario like this. That well now the server hasreceived 2 copies of the connection request. So, it has received one connection requesthere. But remember that this particular sequence number is not there, in the originalpacket this is just to give you an indication that well there are 2 different connectionrequest packets. So, the server has received one connection request packet and then it hasreceived another connection request packet. It may happen that this particular connectionrequest packet got delayed and it was transferred by the intermediate router aftersometime. Because of that delay it has received late compared to this first connectionrequest packet.Now, the problem for the server is to find out that whether this connection request onethat it has received, whether that is a new connection request or it is a duplicate of theconnection request to that that it has already received. Now the interesting fact here isthat, it may happen that the server has crashed and re-initiated the connection. Sodistinguishing between these two becomes very difficult that, whether it is just like newpacket, new connection request message that is being received or it has happened thatwell either the server or say for this example the client has crashed after sending this firstconnection request packet and then the client is trying to establish another connectionrequest.So, it may happen that say here is your client and here is your server. So, the client hassent one connection request message, after the client has sent that connection requestmessage, say at this point the client has crashed. So, there is a crash here. So, the clientgot crashed and after some time, the client again re-initiates and it sends anotherconnection request message to the server.Now, when the client sends the second connection request message to the server, itbecomes difficult for the server to find out whether this connection request it is a newconnection request or it is a duplicate of this connection request. Because remember thatthe server does not know whether the client has been crashed or not, that information hasnot reached to the server. So, because of all this reason, the entire principle of connectionestablishment in a packet switching network is very difficult, because you need todifferentiate between the original request and it is delayed duplicates and the challengecomes that how will you differentiate between the original request and the correspondingdelayed duplicate.So, in the context of connection establishment, we always has this kind of debate. Thatwhether we will go for the protocol correctness or we want to design a protocol whichwill perform good. Because if you want for the correctness what you have to ensure thatyou need to add multiple other modules to differentiate between a new connection from adelayed duplicates.So, the question comes that whenever you will execute those modules for finding outwhether that is a old connection of or a delayed duplicate message or a new connectionrequest, this entire protocol things become complicated and it reduces the overallperformance because this works like a over head for the data delivery. You are notactually doing the data delivery, rather you are spending a considerable amount of timejust for establishing the connection. So, that’s why you have this kind of debate onwhether we want a correct protocol or whether we still can work good with acompromised, little compromised protocol which is not totally correct, it can fail undercertain scenario, but still it will give good performance. So, this delayed duplicate theycreate a huge confusion in the packet switching network.So, a major challenge in a packet switching network is develop a protocol which will beable to handle the delayed duplicates. So, it is just like that sometime, we design aprotocol which will completely be able to handle the delayed duplicates. So, you willgive the preference over correctness or some time we give preference over performance.And whenever we give preference over performance still we need to find out a protocol,which will have at least acceptable level of conformation in handling the delayedduplicates in the network.
Transport Layer: Connection-Part 2
So let us see what are the different possible solution that can we that can have in thiscontext. So, first of all you can use throwaway transport address or the port numbers so,we have discussed this earlier that this port number it is a mapping between yourtransport layer and the corresponding application. So it may happen that multipleapplications in your machine are trying to use the TCP protocol to transfer the data. So, itis just like that, you have this application 1 and application 2 which are running on amachine and both of them are transferring data. Now whenever your network protocolstacks say this is a transport layer of protocol stack, whenever it receives some data froma remote host it need to find out whether that particular data is for application 1 orapplication 2. So, during that time we use the concept of port number, to differentiatebetween application 1 and application 2. So, this port number application 1 runs in oneport say it is running in 8080 port, application 2 runs in a different port say it is runningin 2345 port. By looking into the port number in the transport layer header, we will beable to differentiate between application 1 and application 2. Now although we’ll be ableto differentiate between the application, but the question comes that can we utilize thisport number to differentiate between the normal packet and the delayed duplicate. Now ifwe design a protocol where if a machine get crashed, it will use different port number forinitiating a new connection, if that is the case, then probably we will be able to solve thisproblem.So, it is just like that that our solution says that do not use a port number, if it has beenused once already. So if you have already used the port so, the delayed duplicate packetsit will never find their way to a transport process. So, it is just like that say thisapplication 1 say application 1, I am writing it an A1. It was initiated a connectionestablishment message say port through port 8080 and after that this particular processget trashed. Now if you are running the application again then run it in a different portsay 8082.If it is the case and if you are sending another connection establishment message here,then this earlier connection establishment message that you have sent through port 8080whenever you will receive a reply of that, say a reply of this connection establishmentmessage that will also come in port 8080 and the transport layer will not be able todeliver that and it will correctly discard that particular reply message. And if a replycomes in port 8082, the reply comes in port 8082, then the transport layer will be able todeliver it to the application A1.So, this is a possible solution, but the problem comes that this solution is not feasible.Because we have a finite number of this kind of transport addresses or port numberbecause we have this finite number of ports. So, you cannot throw out a port numberonce it is being used. So, in that case theoretically will be requiring infinite number ofport addresses which is not feasible for the practical implementation point of view, andwhenever also your utilizing multiple application so, there are multiple applicationswhich are kind to send data over the network.So, the second solution can be like that give each connection unique identifier, which ischosen by the initiating party and put that unique identifier in each approach. Now thisapproach looks good, but the problem with this approach is that every time you need todesign a unique identifier and you need to ensure that identifies is unique globally. So,ensuring that identifier is unique globally, again the problem is that what would be youralgorithm to generate that identifier and even if you design an algorithm to generate aunique identifier, which will be able to sustain even after a system is getting crashed, youhave to obviously, use certain kind of hardware trigger here because you want to initiatethat even after the system get crashed and recover from that crash, it will not use the oldidentifier that is being utilized once. So, the third possible solution that we can utilize is to design a mechanism to kill off theaged packets or the old packets in the network. So, that is just like the restricting thepacket life time. So, if you look into the problem that we are facing it is because of thedelayed duplicates. So the duplicate packets which have been transmitted earlier, but thatgot stuck somewhere in the network, now those packets have been being transferred tothe other end. So, whenever those have been transferred to the other end, then the otherend is in a confusion whether that delayed duplicate is just because the system has gotcrashed and now recovered and sent a new packet, new connection request packet or it isjust delayed duplicate of the old connection request packet through which the connectionhas already been established.So, if because all this problems, our life becomes complicated because of this delayedduplicate. If we can eliminate the possibility of delayed duplicate from the network, thenthis entire solution become simple. Now the question comes that how we will be able toeliminate the delayed duplicate from the network.And the solution is that if you associate with a packet life time with every individualpacket that you are sending in the network, then you can say or you can design theprotocol that well, once you are sending a new connection request message, you willmake sure that the old connection request message it has already died off or it hasalready been taken out of the network, because it is lifetime has been expired.Now let us see that how you can designed it is solution. So, the first requirement is thatyou need to restrict the packet lifetime you need to design a way to restrict the packetlifetime. So, there are 3 different ways to restrict the packet life time. The first one is thatyou make a restricted network design; that means you prevent the packets from looping.You can have a maximum delay bound which also include the congestion delay on everyindividual packet.And if a packet expires that particular time from its originating time, then that packet isautomatically dropped from the network. The second is start second solution is that youput a hop count information in each packet. So, the idea is that whenever you are sendinga packet in the transport layer in that packet you put a maximum hop count value say themaximum hop count value is 10.Now, whenever a packet is being traversed over the network then every individual hopjust reduces that hop count. So, whenever it goes to the first a hop router it reduces itfrom 10 to 9. Whenever it goes to the second hop router the second hop router reduces itfrom 9 to 8 and that way it goes on. And whenever that hop count becomes 0, it willsimply drop that packet. So, this is a very feasible solution which is in that used intoday’s network, to ensure that a packet is not hopping in the network for infiniteduration.The third possible solution is you put a timestamp with each packet and that particulartimestamp will define the lifetime of a packet. But this particular solution is not veryfeasible or not very practical from a network perspective because in that case you requireproper time synchronization among individual devices in the network, which is verydifficult to achieve in a real scenario. Because whenever you have 2 difference systemthere will be a certain clock drift between these 2 system. So, ensuring this lifetime basedon the timestamping of each packet where you will be requiring strict synchronizationacross different devices, ensuring that is little bit different.Well our entire design challenge here is that, we need to guarantee not only that a packetis dead, but all acknowledgement of it are also dead. So, this is an interestingrequirement, because whenever you are sending a connection request message it mayhappen that from the server side and here is the client side, say from the client side, youhave sent a connection request message and then the client got crashed and it hasrestarted again say it has restarted again at this point, now here it receives the replymessage.and not the brown request and it can correctly drop that particular reply message. So, let us see that how we can do this or how we can handle the delayed duplicatesduring the case of connection establishment. So, we define the maximum packet lifetimeThis virtual clock is a sequence number field which is generated based on the clock ticks.So, it is just like that every individual packet that you are sending out, that individualpacket will contain a sequence number. And by looking into the sequence number, youwill become sure whether that particular packet was the intended packet or not.So, here is the broad idea that you label every segment to a sequence number, and thatparticular sequence number will not be reused within that T second duration. So, whatwe say that within that T second duration every segment or every packet that I have sentinto the network, it will die off, the packet will die off as well as all traces of that packetthat means if there is certain acknowledgement for that packet they will also get die off.So, with this particular principle you can say that if you are not going to reuse thatsequence number, within that T second of duration, you will be able to ensure that at anytime, there would be only a single instance of a packet with a unique sequence number.So, just giving you an one example say you have transferred the packet of say sequencenumber 1 2 5, sequence number 125 and you say T equal to 1 minute; that means, youare trying to ensure that once you have transmitted packet, with say sequence number125 within this 1 minute duration, this particular sequence number 125 is not going to bereused. If you can ensure that then you know that after 1 minute duration, the packet thatyou have send to it sequence number 125 that is going to die off from the network. So, sothe packet will be there in the network for 1 minute and within that 1 minute duration, ifyou are not sending any other packet with the same sequence number the same sequencenumber 125, then you will be sure that well no traces of this packet no other traces or theduplicate traces of the packets will be there in your network. So, so that way you will beable to ensure that whenever the other end will receive a packet with this sequencenumber 125, that is the only packet that is traversing in the network or not a delayedduplicate of that particular packet. So, this period T and the rate of packets per seconddetermines the size of the sequence number.So, we want to ensure that at most one packet with a given sequence number maybeoutstanding at any given time. So, it is just like that once you have sent a packet with asequence number 125 within that T second duration or within that T duration, you do notsend any other packet with the same sequence number. So, only that packet with thesequence number 125 is outstanding in the network within that particular duration.
Transport Layer: Connection -Part 3
So, here we have 2 important requirements that we need to ensure. So, this 2 requirementwas published by Tomlinson in 1975 in a part breaking work titled “Selecting SequenceNumbers”. So, the first requirement is that the sequence numbers they must be chosensuch that a particular sequence number refer never refers to more than 1 byte. So, if youare using byte sequence numbers. So, byte sequence number means that for everyindividual byte that you are sending in the network they has a sequence numbers.So, that TCP type of protocol it uses byte sequence number rather than the packetsequence numbers. So, in case of a packet sequence number for every individual packetthat you are transferring in the network, you put one sequence number for the packet, forthe byte sequence number, every individual byte that you are transferring in the network,you put one sequence number for that.So, the byte sequence number is something like this like if your packet has some 100byte data. So the packet has 100 byte data, so in the header field you have 2 differentfield. One is this sequence number and another is the length. So the length says that youhave 100 byte data, the sequence number field is a 500; that means, in this particularpacket you have data from 500 bytes to 600 bytes, 501 bytes to 600 bytes. So, you havetotal 100 bytes of data.So, that way you can use the byte sequence numbering to individually identify everybytes in the networks. So, that would be useful later on we’ll see for ensuring segmentwise delivery on top of a transport layer protocol. So, the requirement here is that everysequence number that you are sending to the network, it indicates to only a single bytenot more than 1 bytes, so there should not be more than 1 bytes in the network for thesame source destination pairs which are referenced by a single sequence number.Now, in this case the challenge comes that how will you choose the initial sequencenumber? The initial sequence number is required during the connection establishmentface, when you are trying to send data to a remote host. So, that was the firstrequirement. And the second requirement is that the valid range of sequence number must bepositively synchronized between the sender and the receiver, whenever a connection isbeing used. So, this means that whenever you have set up this initial sequence number,then all the subsequent bytes will follow that sequence number. So, this is basicallyensured by the flow control algorithms.So, the one example can be something like this, say you have a client and you have aserver. Now the client sends request message with say initial sequence number as 1000,and the server sends a reply mentioning that it accepts the initial sequence number as1000. Now once this connection establishment is being done, then all the subsequentpackets that is being sent by the client it follows this sequence number space.So, the first packet say it will start from 1001 and it has the length of 50 bytes. So, thisthings I am writing in the form of ‘sequence number, length’. So that means, the firstthe problem will be taken care of by the flow control algorithm, but the problem is thefirst requirement which was there, that how will you choose this initial sequence number.to be reused to within certain duration of T.So, that time bound need to be there and within that time duration that initial sequencenumber is not going to be reused such that the server it can differentiate between acorrectly sent connection request and the delayed duplicate of it. that means, every by that you are sending using this sequence number field, that will bethere in the network for this time duration T.Now if this connection get crashed and if you are initiating another connection with thisinitial sequence number, say with this initial sequence number, then the problem is thatyou can see that here you have 2 different packets you may have 2 different packets,which are there in the network, one is the old packet from the connection 1 which wasstill there in the network and the new packet from connection 2. So, there can be aconfusion. Or the second thing is that you use the sequence number which is high enough from thesequence number field that you have used for the connection 1. So, that is our requirement. So you want to either either wait for a duration so, that wemake ensure that all the previous bytes with the old sequence number that are gone outof the network or you use a initial sequence number, which is high enough compared tothe previous sequence number that has been utilized for this connection establishment, sothat the connection zone of 2 nodes they doesn’t get with each, we call it as a forbidden range okay? Because once one sequence number isbeing used, you should not reuse the sequence number anymore.So, in the next class we will look into the details about how you can design a mechanismfor selecting the initial sequence number so, that you can avoid the overlapping of theforbidden zones for two different connection. So, see you all in the next class.Thank you.