Lesson 5 - Application Layer
The application layer of the TCP/IP model contains the protocols used by applications to facilitate application to application communication between networked devices. In this lesson we're going to look at some of those protocols and what that application to application communication looks like. We'll be looking at web browsing, email, and file transfers.
When referring to web browsing there are some terms we need to define before starting the conversation.
Web browser (browser) - A program installed on a user's computer that displays web pages.
Web server - A program installed on a computer that hosts websites.
Web content - The data viewed with a web browser. This includes everything combined together to create a webpage. (Text, images, ads etc)
Web pages - The individual pages in a website that contain the web content.
Website - A collection of related web pages.
When you visit a web page you type in the URL (Uniform Resource Locator) in your web browser's address bar. A URL is the address of the web page and has two components. An example of a URL is http://www.cis131.com. The part before the :// is the protocol, and the part after is the location of the page. HTTP (HyperText Transfer Protocol) is the protocol used. You can specify a specific web page within a web site by including the web pages path as part of the URL. For example http://www.cis131.com/lessons/lesson05.htm would open the lesson 5 web page. If a specific web page isn't specified then the web server will return the web page it has configured as the default.
The protocols at the application layer define how applications talk to each other. A web browser talks to the web server. When your web browser requests a web page from the web server it sends an HTTP GET message. The web server responds with an HTTP OK message that includes the requested data.
The second major version of HTTP called HTTP/2 includes a new feature that optimized the transmission of web content when viewing a web page. I web server will push the web content needed to display a webpage when a web page is requested. This results in web pages loading faster.
The third major version of HTTP called HTTP/3 is even more optimized for the transmission of web content. With HTTP/2 if one file's transfer is not delivered then all connections have to wait for the recovery. With HTTP/3 each file is sent over a separate stream. This allows data to continue to flow in the other streams if there are errors in one.
Email is a primary means of communication by many people throughout the world. Email addresses use a very recognizable pattern. They can be separated into two parts at the @ symbol. The part to the right of the @ symbol is used to locate the destination email server. The part before the @ symbol is the recipient's username on that server. In the email address email@example.com the server can be found at cis131.com and the username on that server is mrhull.
When sending and receiving email more than one protocol is used. SMTP (Simple Mail Transfer Protocol) is used to send email, and POP3 (Post Office Protocol v3) and IMAP4 (Internet Message Access Protocol v4) are used to get email. POP3 is used to pull your email from the mail server and store it on your device. IMAP4 lets you connect to the mailbox on the server and view the mail. If you check your email on more than one device then IMAP4 is the preferred method. If you delete a message, or mark it read while using IMAP4 it's changed in the mailbox so all you other devices see it the same way. If you use POP3 the change is performed on the device, not the mailbox so you have to do it again when viewing your mail from another device.
When sending email using SMTP your client mail program has a conversation with your mail server. The RFC for SMTP clearly defines the messages going back and forth between the client and server. Below you'll see an example of the application level communication taking place between the client and server.
The conversation that takes place between the mail client and mail server is a back and forth conversation. If the mail server doesn't like something the client does it can terminate the connection. For example if the email is coming from a known spamming address it can reject the data and drop the connection.
POP3 is a little different than SMTP. In order for you to get your email you need to prove you're authorized to retrieve the email. This is done by supplying a username and password to the mail server. If you provide the right username and password you will start receiving your email.
When you send email to someone it will go from your device to your mail server. Your mail server will then send the message to the receiver's mail server where it will sit until they check their email. Once they check their email the message will be downloaded to their device. The image below shows how POP3 and SMTP work together.
When you want to share large files with others, usually attaching them to an email message isn't an option. Most mail server limit the size of attachments. In this scenario you would need a place to put the files so the recipients can go and get them. This can be done with an FTP server (File Transfer Protocol).
When you upload a file to an FTP server the put command is used to send the data to the server. Once the data starts transferring a second connecting is established to transfer the data. An FTP connection uses two connections, one for commands, and the other for data transfer.
When you download a file from an FTP server the get command is used.