 Now that we have seen how the network layer takes packets from one end of the network to the other and the transport layer ensures reliable delivery. What we have to see is how do these packets actually find their way to the correct application. For example, you may have multiple applications open on your desktop. You may have a browser open. You may have some other application, maybe your remote logged in into another workspace or you may have a third application which could be your antivirus, which is running and so on and so forth. Now all these packets are coming to the same machine and TCP has to now figure out whom to hand over these packets to. How does it do that? For this, there is the concept of a port number. So every application is associated with what is called a port number. Port number is not a real entity, but a virtual entity. It's an idea wherein we say that HTTP is port number 80. So when any packet comes to the machine for port number 80, TCP knows that it has to hand over that packet to the HTTP application. So out of all the applications, so whenever an application is started on your machine, it's associated with a port number and then when it makes a request, that particular port number is tracked so that when the reply comes, the reply can be handed off to the appropriate application. While this sounds complex, it actually simplifies our life. Imagine if we had to write applications wherein each application would have to take care of this sending of packets and keeping track of the acknowledgments and doing all the work on their own. So because of the layered architecture which we saw and the modularity in the system, each application does not need to do that. What does the application need to do? Let's say you're building a new application, which is going to use TCP. What does your application need to do? Your application simply needs to say that I'm going to use TCP and as soon as your application starts, automatically TCP comes below it to provide all the services that are required for reliable communication. Once a port number is assigned to your application, TCP also knows what to do with replies or packets that are intended for your application. So at the application layer, which is the topmost layer, which is what we are often concerned with, it looks very simple. There is a client, there is a server or in today's world, there is the cloud where there is a cloud of servers. It does not matter. The idea is still the same. So you have somebody who is going to generate a request, which goes to a server and you have somebody who is going to send back a reply. So this request reply scheme is the basic form in which communication happens. If it is reliable communication, the request reply scheme is supported by TCP. If it is datagram communication, which basically means some loss is acceptable. In those cases, the communication is built on UDP. That's basically how the application layer works.