The whole Internet, hardware and software, was designed and developed to provide services at the application layer. The application layer is the first layer in TCP/IP protocol.
In Communication is provided using a logical connection, which means, here two application layers let us there is an imaginary direct connection through which they can send and receive messages. We can see figure, the logical connection takes place between the application layer at a computer at Sky Research and the application layer of a server at Scientific Books.
Standard Application Layer Protocol
There are several application-layer protocols that hava been standardized and documented by the Internet authority, and we are using them in our daily interaction with the Internet. Every standard protocol is a pair of computer programs that interact with the user and the transport layer to provide a specific service to the user.
NonStandard Application Layer Protocol
A programmer can create a nonstandard application-layer program if she can write two progarams that provide service to the user by interacting with the transport layer. The creation of the nonstandard protocol that does not need a approval of internet authorities if privately used, has made the internet so popular in the world. A private organization can create a new customized application protocol to communicate with all of its offices around the world.
Application-Layer Paradigms
It is clear that we need two application programs to interact with each other: one running on the computer somewhere else in the world. The two programs need to send message to each other through the internet infrastructure. However two paradigms have been developed during the life time of the internet such as Client-Server paradigms and Peer-to-Peer paradigms.
Client-Server paradigms
Client-server paradigms is traditional paradigms. It was the most popular paradigms until a few years ago. In this paradigms, the service provider is an application program, called the server process; it runs continuously, waiting for another application program, called the client process, to make a connection through the internet and ask for service. The server process must be running always; the client process is started when the client needs to receive service.
In other word, the lifetime of a server is infinite: it should be started and run forever, waiting for the clients. The lifetime of a client is finite: it normally sends a finite number of requests to the corresponding server, receives the response and stops.
Peer-to-Peer paradigms
A new paradigms called the peer-to-peer paradigms has emerged to responds to the need of some new applications. In this paradigms, there is no need for a server process to be running all time and waiting for client processes to connect. A computer connected to the internet can provide service at one time and receive service at another time. A computer can even provide and receive at the same time.
Application Programming Interface(API)
A computer program is normally written in a computer language with a predefine set of instructions that tell the computer what to do. A computer language has a set of instructions for mathematical operations, a set of instructions for manipulation, a set of instructions for input/output access, and so on. If we need a process to be able to communicate with another process, we need a new set of instructions of this kind is normally referred to as Application Programming Interface. In this case, one of the entities is the process of the application layer and the other is the operating system that encapsulates the first four layer of the TCP/IP protocol suite. In this way the processes running at the application layer are able to communicate with the operating system when sending and receiving messages through the internet.
Socket Addresses
A socket address should first define the computer on which a client or a server is running. A computer in the internet is uniquely define by its IP address a 32-bit integer in the current version. However we need another identifier to define the spacific client or server involed in the communication. An application program can be defined by a port number, a 16-bit integer. A socket address should be combination of an IP address and a port number.