 ृ... మాదరటరజా మవమె . సి � subtitles సి పికోతో సి滿. కోగిరామాత౟ా. సహఎతి వనాసకరన్టి. హటరూ మాపికా, can మ próxima మరి . మవసగూడిపతో � win in its gas ration is 10% on your sky. If the address is 0 to 255 that is all 0s and all 1s consequently each segment in the address is anywhere between 0 to 255 so a typical address would be 191.48.144.16 or 250.something something something how will you know whether the address is class A, class B, class C or class D? simple no, not necessarily beginning with one because decimal one is not necessarily the first bit one so what you have to do is you have to translate 191 into binary and consider the first few bits to determine what address it is there are some special addresses for example 0.0.0.0 means this host that is me myself 255 is all host 127.anything is a look back that means I am the transmitter and I am also the receiver the host address could be divided into subnet address and host address so subnet is that part which describes the network address and host address is that part which describes the host so why do we require special IP address? well for example let me just explain this look back thing there are occasions when I just want to test whether my network protocol software is working alright or not now rather than bothering somebody else if I can test with myself that will be ideal now this requirement was so peculiar in the early days of networking that people decided to give that special address 127 is the first byte only you determine what class address it is everything else that you say is look back now this was a generic provision that they made at that time many of these standardizations by the way often happen because of the whims and fancies of the early developers there is no rational reason just like the name Kodal came out of nowhere something very similar some standardization still makes sense some other does not there is a multicast address there is a separate class for that that makes sense when I want to multicast but these addresses are going to later on we shall see more such addresses when it we come to discuss port which is another addressing entity in the communication protocol so there is no specific reason why this have come out like this now this is the complete map of the IP data gram by the way a packet in the IP protocol is called a data gram like a telegram so telegram contains information data gram contains information in this you will find the most important part from our perspective is the source address the destination address because source address defines to whom this packet is targeted destination who is originator and destination who is the target so these are the two full IP addresses clearly the width of this line is 32 bits there is 32 bit is the address there are of course options this is not the data gram this is the data gram header along with this header will be the actual payload which could be 1500 bytes 2000 bytes 5000 bytes upto 65 64 K that could be the actual length of the the first portion is the version the header length because the header length need not be fixed type of service that is being provided by this or is being carried out in this packet total length this total length is not the length of this header but header plus payload so you know exactly to the last byte how many bytes are comprising this packet there is some identification there are whole lot of things time to live is a very interesting thing you know when you send the packets the packets will transfer from one place to another there are some routing mechanisms now sometimes some jinx occurs in the routing and the packet starts up here goes to Delhi, goes to Calcutta, goes to Madras and instead of running up in Coimbatore comes back to Bombay and if it goes better it keeps rotating like that now it is a drain on the resource because nothing useful is being served every time a packet leaves a router a counter is decremented this time to live is nothing that a counter it is set at some arbitrary value let's say 200 or 50 or 25 or something that means I expect this packet to reach the destination in 25 hops every time it crosses a router router will reduce that count by 1 while sending that packet further so originally it had 25 units to live then 24 then 23 etc. somewhere it will become 0 much before that it should have reached my destination but if it becomes 0 then that particular router where it is making it 0 it choose up that packet saying it has lived its existence this is to ensure that unnecessary traffic does not build up in rare cases exact protocol that is being used we shall see there are two important protocols in TCP IP one is called the TCP protocol and the other is called the UDP we shall see that and we shall see the implication all other things are technical details we need not bother about so again in a nutshell there is a source address there is a destination address there is time to live to ensure that the packets meaningfully circulate there is a version number which is IPv4, IPv6 or whatever and there is total length that is what is the packet size that is being transmitted these are the important components here now we look at the transport layer remember this so far the discussion was about the IP layer the IP layer is the one which takes these packets and sends them and receives them and they work with the host address destination address source address etc but something meaningful has to be done and that happens at the transport layer at the transport layer there are two protocols one is called a transmission control protocol or TCP and the other is called user data gram protocol which is UDP it is this protocol which is responsible for establishing a reliable connection transmission control protocol and to ensure error free delivery so if for example you are logging on to a remote server you want a connection to be established and to be retained logically as one as you are working you don't want that connection to break let's say you are working on a payment gateway or you are doing a railway reservation or you are running an SQL query and connected to an SQL server you would like a tight connection between you you are doing a file transfer now till the whole file is transferred you would like to retain that connection so consequently the transmission control protocol or TCP is called the connection oriented protocol it is responsible for establishing an end-to-end logical connection to retain it till your work is done and it is supposed to ensure error free delivery of your packets either way very clearly if it has to guarantee error free delivery then for every packet which is delivered it will expect some kind of an acknowledgement from the other end saying it has received this packet error free and that is why it is a heavy protocol it requires more bandwidth to be utilized but it ensures absolutely correct thing the other protocol is called the user datagram protocol or UDP protocol this is a connection less protocol there is no connection that is established the host simply sends a packet and the packet is supposedly received by the other it does not guarantee error free transmission however it guarantees transmission to the best of its ability you should use it only when you are not particularly keen to receive all packets necessarily but you want quick response quick service remember I told you the transmission control protocol is a heavy protocol because it establishes a connection so part of the protocol is vested in establishing that connection part of the protocol is vested in ensuring that packets reach their acknowledgement etc but there are occasions where you simply want to send the packet as quickly as possible then you do not use that you use the UDP protocol let me first describe where UDP protocol is used at all after all I do not want errorless communication right whichever protocol I use so what will be the use of UDP protocol it is heavily used for what you call one shot request reply queries that is I want to send a request and I want to get a quick reply or I want to keep getting replies without bothering about any request I have made one request look at the transmission of speech and video remember I told you that for transmission we often use IP multicast imagine now there are 20 centres which are receiving these video signals these video signals in the application level are getting digitized and they are getting packetized IP packets are flowing but above that what should be the control TCP or UDP we use UDP protocol it is called UDP multicast for the simple reason that UDP packets are flowing mostly they will arrive at the same sequence in which they are being sent because they are transmitting or transmitted through a satellite channel secondly in a video audio signal a few packets going missing actually correspond to a small bridge but they do not affect the semantics of the entire larger information that is being brought you would have heard this when you use a speech that is somebody is talking to you from across the continent sometimes you listen to a small glitch that glitch is happening because maybe a couple of packets are just gone away the packets are very small many packets together back even a sensible 0.5 second audio or video so consequently a few packets getting lost really it does not matter in some situation but even for voice and video when you want an absolute guarantee you will use TCP on the other hand using UDP ensures very quick transmission because there is no overhead just take the packet through it typically for multicast you will always use that and there is one more usage that we will see later during this talk itself so this is error prompt but less need connection oriented and connection less in our normal life so we should compare with connection oriented to a telephone call as I mentioned a connection is establish logical connection connection less to a postal service I send a lifafire to my friend I drop it in the post office box this is a datagram which has left me it will travel through various post offices still it reaches him I am not waiting for acknowledgement and I generally assume that the letter will reach my destination once in a while I read in the newspaper you see the letter after 15 years but these are reality and I don't live with that if I want an acknowledgement and if I want to create an effective connection oriented thing even though spend over many days or months I will use in my postal services a facility which is called acknowledgement or register already acknowledgement view that means whenever you reach this packet to the destination please send me a small piece of paper which is signature that may happen over multiple days but if I want that connection oriented protocol it must happen in milliseconds and there is an overhead the postal department has to work extra hard to take that signature send it back all the way to me ensure that I receive it and anytime I can go with the original receipt to the post office saying what happened to this I had sent acknowledgement so that is connection oriented and connection raises simply dropping an animal so TCP and UDP are exactly like that at the transport layer let us look at TCP this is called the transmission control protocol this is a reliable end to end byte stream it takes data stream that is a file to be transferred consider a file is let's say 28 megabyte file last file now you want to transfer a 28 megabyte cannot fit into a single packet so that you will actually when you do an FTP at the application level TCP will connect the byte stream it will open that file and connect that byte stream to the TCP protocol the TCP protocol will keep collecting bytes and keep building IP packets which are all smaller than 64K and then we will send these IP packets through the IP part of the net but because the transmission control protocol is in command it will expect an acknowledgement for every packet and it will ensure error free transmission to establish a connection a logical connection TCP protocol uses an additional mechanism of addressing remember IP address is there for the host IP address is there for the source IP address is there for the distribution but to establish a connection there has to be something more than just the IP addresses and that something more is in the form of sockets so the sockets are created at the two end points and there is a virtual or logical connection between these sockets each socket has an IP address as is well understood additionally it has a port number which is a 16 bit port number port you will recall is like a sea port you know ships come and dock there at the port so a ship coming from England could dock into Mumbai could dock into Kandla could dock into Vishakhapatnam could dock into any other ports so this country which consider a single IP address has multiple ports and may be US ships will dock here UK ships will dock there Malaysian ships will dock in Vishakhapatnam whatever whatever I might have my own arrangement exactly similar to that in programming I can make arrangement such that I can have multiple sockets each socket is one host address and a port number it is possible to open multiple sockets in the same computer I just have to have a different port number for the same IP address so this is the connection oriented mechanism that TCP provides and socket programming is a well understood well analyzed and well required programming paradigm for the software professionals who do programming as the communication protocol so if for example you have a Java application which has to communicate with a database server at the back end the way this Java application will communicate with the database server will be using the TCP protocol and internally it will open port here open port there connect the port and send queries collect results whatever what so that is the importance of this remember IP address is 32 bit and port address is 16 bit the connection is always identified by pair of sockets so at one end socket one at another end socket two now somebody was asking about standardization here is some more standardization ports which are less than 256 in value are used for special services they are called special there is nothing special if you see the platform of application that you have it is only commonly used applications which have been termed as special and port numbers have been assigned so if at all you are doing FTP file transfer the FTP or file transfer protocol will always use port 21 tell not or making your machine as a terminal to another machine will always use port 23 the connections are called full duplex that means information can flow both ways from here to there from there to there so socket to socket is the as if connection and IP packets can flow across acknowledgments can flow across and you have a two error free connection oriented protocol of course connection can break at any one point but if the connection breaks it is guaranteed that you know what is the last packet transmitted which has been received correctly by the other the data is handed exchange in segments there is a header TCP header which is a 20 byte header plus options and then it has data so here is the TCP header so TCP header has a source port destination port it has a sequence number it has a TCP header length flags window size acknowledgement number check sum remember no bit has to be lost there is the job of this layer to ensure although at every layer the protocol tries to ensure correct transmission and reception but this is the ultimate responsibility so check sum is nothing but some kind of a numerical value coming out of the entire packet so this is the packet or the header or the whole datagram plus I mean TCP packet then there will be check sum for that there are the options and there is data so this is what the TCP header is please note that we have a source port and destination port number to UDP so UDP has a source port and a destination port it has UDP length and UDP check sum you see how simple the UDP packet is UDP protocol because it has to define where the source is where the destination is and this is the UDP header format it sends and receives capsules of raw IP datagrams so it will capsule the raw IP datagrams and send them the individual datagrams will move as an IP thing now comes the thing which is important from our perspective we as human beings are not good in remembering numerical identities I don't know some of you remember phone numbers very well but I find even that difficult in general to remember that his IP address is 191.16.144.73 is not going to be easy somebody wants to address my machine you would much more prefer it to be saying something like dvp at it.itb.ht.in we recognize those addresses consequently a simplification of address occurred very early in life in ARPANET itself there used to be a file called hosts.txt so this was a text file and this file actually contained the name of the host and the IP address so it could be used as a translation table even today slash etc slash hosts for example would be able to give you exactly the same kind of thing a domain name system was soon evolved and this domain name system defined a hierarchical addressing scheme for example the last component of that address is a generic address such as .in.jp.uk you can see it stands for India, Japan, UK there have been .us but .us did the data query because they originated the network so they said that whenever there is no national then it is me so those addresses now are called generic addresses .com.org.edu if I have .edu.jp then it is an educational institute in Japan but .edu invariably means an educational institute in US of course to be fair they became very generous about it and they said let us call these as generic names that means even you and I in India, Japan, Czechoslovakia can have a .com address invariably all .com and .org addresses are still served from servers within United States but that is incidental but these are called generic address the next level could be CO for company AC for academic ER for educational research network a level below that could be IIT Bombay TIFR persistent systems below IIT Bombay could be IIT AC AC mechanical AE etc. so quark.it.itb.ac.in is the name of a server it is a host machine which is located in IIT which is located in IITB which is located in the academic sub network of Indian net this is a unique address university of course the machines at the level of protocol do not understand the damn thing about such address they understand IP address consequently the domain name system must provide for some kind of a simple and automatic translation between the addresses which are given like this and an IP address IP address is what will be used by people this translation or address location is done through machines which are called DNS servers so they just handle domain name system and domain name servers translation the domain names are case insensitive they are either absolute or relative each domain controls allocation of names under it NCST in India is wrong national centre for software technology used to control the domain names now no single organization controls the domain name allocation there are commercial people who allocate domain names to you there is a registry maintained by the government of India NCST itself does not exist anymore it is now part of CDAC they still have a role but that is how it is the length of the name can be 63 any individual name between dots and the total must be 255 characters that's the restriction that was imposed on how do you resolve the domain name because networks understand IP address to resolve the domain name you have a name you give that name to a server which does this resolution that server does some ging down and finds out the IP address and sends it back to you so the purpose of a DNS server is to take a name address that is given as inquad.it.itb whatever and send back resource records one of the resource records contain the IP address the DNS server is by the way very well organized it just does not do only this it can do many more things so all the records in DNS server are called resource records these are resources about the domain names and one of the resource records in fact the first one usually will have an IP address now please note that if you want to communicate with the rest of the world using the named address scheme the first thing that you have to do is to get an IP address if you can't get an IP address you can't communicate unless you are communicating using exact IP address yourself now this task will be required how frequently very frequently really everybody in order to initiate any communication will require to resolve this once you resolve this maybe you will bury that IP address in your application somewhere and keep using it but every now and then you go to any website for example how do you go to website you give a web address which is like this address DNS address it has to be resolved it has to be resolved rather quickly to resolve this you don't want to do socket programming and open a socket that is where you use the UDP protocol remember what I said when we discussed the UDP protocol single request response kind of thing this is exactly the case I send a request I have this name give me IP address and that sends the IP address I don't want any overhead so I send it consequently I send it where to a DNS server the first thing that every machine must know which is on the network is the DNS server which will be utilized by that machine to resolve this address so in your network parameterization for example you will find the name of the DNS server to be split of course there is always a default for a local area network there is a default DNS server default DNS gateways the point I am making is you use UDP because you send this packet very quickly send give me the IP address and usually the DNS server quickly searches and sends you the IP address now this is not an error free protocol suppose you don't get back anything you don't do anything you send the request again after all if you send the same request same times and you got the response 9 times out of 10 it doesn't matter you are not harming anyone you can afford to keep sending the request till you get the DNS response and since you don't want to waste overheads of connection oriented protocol you use UDP for that this is by the way a standard question which many networking experts have failed to answer give the most simple UDP utilization in real life that utilization is DNS resolution because you don't want to waste time in overheads so it would be cool for anyone of you to ask any friend from computer science saying do you know where UDP is used they will typically say voice video etc but they will often fail to recognize this