The Application Layer is a set of protocols that provide communication services to applications. Common protocols are HTTP (for web pages), HTTPS (secured version of HTTP), SMTP, POP3 and IMAP (for email), and DNS (used to look up IP addresses of URLs).
The Client/Server Model
In simple terms, clients ask servers for data and servers send data to clients. In the internet, clients are (typically) web browsers that ask servers for web pages and related files, and servers respond by sending them to the client.
A “server” isn’t necessarily — and usually isn’t — one physical machine. It’s usually a group of networked machines that are assigned different tasks that the website they are hosting might need. So, for example, one machine might store data: a “data server.” Another might store and execute applications: an “application server.” Another might be responsible for formatting a web page based on the instructions of an application, and populated with data from the data server. That’s a “web server.”
Furthermore, websites are often replicated (i.e. identical copies are made) over several machines to help load balance traffic. Load balancing reduces bottlenecks by spreading traffic out in such a way as to even out the load on individual servers. Also, replicating servers in different regions of the world reduces hops.
As far as the “client-server model” is concerned, though, multiple replicated servers are part of the “server” end of the model. When client types a URL into a browser window, the server (more specifically, the web server) is the entity that the URL references.
URLs
A Uniform Resource Locator, or URL, is a combination of several components that comprise a reference to a resource on the internet. These components are scheme, host, port, path and query parameters. A URL requires a scheme and the host, while the other components are optional.
Host and Scheme
The host can be an IP address, but IP addresses are hard to remember and easy to get wrong. So, URLs usually use a domain name to refer to the host. Domain names are names associated with IP addresses. For example, a request sent to the IP address 129.42.38.10
and one sent to the domain name ibm.com
are equivalent. They will both return the home page on IBM’s website.
In the URL http://robertrodes.com
, http
is the scheme and robertrodes.com
is the host. Entering this URL in a browser will bring up the home page on this website.
Ports
Ports are optional, since most schemes are assigned a well-known port number, and most servers use it. For example, http://robertrodes.com:80
will also bring up the home page on this website. Since 80
is the assigned port for the http
scheme, it can be omitted.
Path
The path component is also optional, because a host has a default web page specified (or, at least, a properly designed one does). For example, http://robertrodes.com/index.php
will bring up the same page as http://robertrodes.com
, because /index.php
is the default page.
Similarly, http://robertrodes.com/resume
will bring up the default page in the /resume
directory of the website, as will http://robertrodes.com/resume/index.php
. (The default web page for any directory on a website is usually a file called index
, with whatever extension the server-side programming language uses.)
Query Parameters
A client request may include query parameters, which give additional information that the application uses to service the request. Parameters follow the path component. They begin with a question mark (?
). They take the form of name/value pairs; with an equal sign (=) separating the name and the value, for example parametername=value
. If there are multiple parameters, they are separated by an ampersand (&
).
For example, a recipes website might require a type of recipes to send. A URL might then look like this: http://recipes.com?course=entree&type=chicken
. The underlying server application might use the query parameters to find all recipes in its database that are entrees with chicken in them, and then format them dynamically as a web page and send back the result.
DNS
The Domain Name System (DNS) is a means to translate domain names into IP addresses. Basically, domain names are maintained on servers all over the world. When a client requests a page from a server (typically, a user types a URL into a browser), it first sends the DNS network a query (a request for information) requesting the IP address associated with the domain name in the URL. The DNS looks up the associated IP address and sends it back to the client. The client then the domain name in the request to the server with the IP address, and sends the request out to the internet.
The next article explains how HTTP works.