Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 61
James F. Kurose & Keith W.
Ross Computer Network A Top-Down Approach
Chapter 2 Application Layer
Lecturer By: Hedayatullah ”Adel”
Application Layer The application layer is the topmost layer in the OSI (Open Systems Interconnection) model and the TCP/IP protocol stack. It is responsible for providing network services directly to end-users and applications. This layer interacts with software applications to provide communication services. Section 1. Principle of Network Application The principles of network applications encompass the fundamental concepts and guidelines that govern the design, development, and operation of software applications that communicate over computer networks. At the core of network application development is writing programs that run on different end systems and communicate with each other over the network. Cont. For example, in the Web application there are two distinct programs that communicate with each other: browser program running in the user’s host (Desktop, Laptop) Web server program running in the Web server host. when developing your new application, you need to write software that will run on multiple end systems. This software could be written, for example, in C, Java, or Python. Cont. We discuses the following steps in the principle of Network Application. Network Application Architectures Processing Communicating Transport Services Available to Applications Transport Services Provided by the Internet Application Layer Protocols Network Application Architectures Network application architectures define the structure, design, and components of software applications that communicate over computer networks. There is a difference between network architecture and application architecture. The predominant architectural paradigms are: Client-Server Architecture Peer-to-Peer (P2P) Architecture • In the client-server architecture: • An always-on host with fixed IP address which responding to client's requests. • There is no way to make two clients talk to each other. • In P2P architecture: • There is not reliance on a dedicated server. • The users share the content in a highly decentralized network Processes Communicating Processes on two different end systems communicate with each other by exchanging messages across the computer network. processes communicating with each other reside in the application layer of the five-layer protocol stack. Client and Server Processes we typically label one of the two processes as the client and the other process as the server. With the Web, a browser is a client process and a Web server is a server process. With P2P file sharing, the peer that is downloading the file is labeled as the client, and the peer that is uploading the file is labeled as the server. The Interface Between the Process and the Computer Network • A socket is the interface between the application layer and the transport layer within a host. • The only control that the application developer has on the transport- layer side is: • the choice of transport protocol • perhaps the ability to fix a few transport-layer parameters such as maximum buffer and maximum segment sizes. Cont. • Application processes, sockets, and underlying transport protocol. Addressing Processes • To identify the receiving process, two pieces of information need to be specified: • the address of the host • an identifier that specifies the receiving process in the destination host. Transport Services Available to Applications The transport-layer protocol provides services that can be categorized into: reliable data transfer throughput timing Security Transport Services Provided by the Internet The Internet (TCP/IP networks) makes two transport protocols available to applications, UDP and TCP. Each of these protocols offers a different set of services to the invoking applications. The TCP service model includes a connection-oriented service and a reliable data transfer service. It also has a congestion-control mechanism. UDP is a lightweight transport protocol, connectionless. It provides unreliable data transfer service. Section 2. Application-Layer Protocols • An application-layer protocol defines how an application’s processes, running on different end systems, pass messages to each other. In particular, an application- layer protocol defines: The types of messages exchanged The syntax of the various message types The semantics of the fields Rules for determining when and how a process sends messages and responds to messages The Web and HTTP The Web: in the early 1990s, a major new application arrived on the scene—the World Wide Web The Web was the first Internet application that caught the general public’s eye. The Web was the first Internet application that caught the general public’s eye. It dramatically changed, and continues to change, how people interact inside and outside their work environments. HTTP 1989-1991 The Hyper Text Transfer Protocol (HTTP), the Web's application-layer protocol, is at the heart of the Web. It is implemented in client and server program. End-Systems talk to each other using HTTP messages. A Web page consists of objects. An object is a file like: HTML file, JPEG file, etc. The object is addressable by a single URL. The URL consists of a hostname and the object's path. Web browsers implement the HTTP client. Web servers implement the HTTP server like Apache. Cont. HTTP uses TCP as its underlying transport protocol. HTTP need not worry about lost data or the details of how TCP recovers from loss or reordering of data within the network. HTTP is a stateless protocol as it doesn't maintain information about the client. The Web uses the client-server architecture. HTTP request-response behavior Non-Persistent and Persistent Connections HTTP clients and servers can be configured to use non- persistent connections instead. Persistent HTTP uses one TCP connection while the non- persistent uses sperate connection for each request. HTTP with Non-Persistent Connections There can be at most one object that can be sent over a single TCP connection In the non-persistent, users can configure some browsers to control the degree of parallelism. Browsers may open multiple TCP connections and request different parts of the web page over the multiple connections. Round-trip time (RTT) is the time it takes for a small packet to travel from client to server and then back to the client. It includes packet-propagation delays, packet-queuing delays, and packet-processing delays. Cont. Non-persistent connections has two shortcomings: A new connection is maintained for each requested object. Each object suffers a delivery delay of 2 RTTs. HTTP with Persistent Connections
In HTTP Persistent Connections, multiple objects can be
sent over a single TCP Connection. HTTP Message Format
There are two types of HTTP messages.
Request messages. Response messages. HTTP Request Message An HTTP request message is a format used by a client to request data from a web server. It consists of a request line that specifies the HTTP method (such as GET, POST, PUT, DELETE), the resource (URL) to which the request is being made, and the HTTP version being used. Additionally, it includes headers that provide additional information about the request (like the type of content being sent or accepted) and an optional body that can contain data, such as form parameters or a payload for POST requests. GET /somedir/page.html HTTP/1.1 Host: www.someschool.edu Connection: close HTTP Response Message has three sections: an initial status line, six header lines, and then the entity body. HTTP Response Message HTTP/1.1 200 OK Connection: clos Date: Tue, 09 Aug 2011 15:44:04 GMT Server: Apache/2.2.3 (CentOS) Last-Modified: Tue, 09 Aug 2011 15:11:03 GMT Content-Length: 6821 Content-Type: text/html Cookies Cookies are small pieces of data stored on the user's device by the web browser while browsing a website. allow sites to keep track of users. Most major commercial Web sites use cookies today. A socket is the interface between the application layer and the transport layer within a host. Cont. • cookie technology has four components a cookie header line in the HTTP response message. a cookie header line in the HTTP request message. a cookie file kept on the user’s end system and managed by the user’s browser. a back-end database at the Web site. Web Caching A Web cache—also called a proxy server—is a network entity that satisfies HTTP requests on the behalf of an origin Web server. a web cache is a mechanism used to temporarily store web documents such as HTML pages, images, and other content. The primary purpose of a web cache is to reduce latency, network traffic, and server load by serving cached content to users instead of requesting the content from the origin server every time. Cont. Section 3. File Transfer: FTP File Transfer Protocol (FTP) is a standard network protocol used for the transfer of files between a client and a server on a computer network. It operates within the application layer of the OSI model and provides a straightforward way to upload, download, and manage files on a remote server. In a typical FTP session, the user is sitting in front of one host (the local host) and wants to transfer files to or from a remote host. In order for the user to access the remote account, the user must provide a user identification and a password. Cont. HTTP and FTP are both file transfer protocols and have many common characteristic. they both run on top of TCP the two application-layer protocols have some important differences. The most striking difference is that FTP uses two parallel TCP connections to transfer a file, a control connection and a data connection HTTP, sends request and response header lines into the same TCP connection. FTP Commands and Replies The commands, from client to server, and replies, from server to client, are sent across the control connection in 7-bit ASCII format. Thus, like HTTP commands, FTP commands are readable by people. Some of the more common commands are given below: USER username: Used to send the user identification to the server. PASS password: Used to send the user password to the server. LIST: Used to ask the server to send back a list of all the files in the current remote directory. RETR filename: Used to retrieve (that is, get) a file from the current directory of the remote host. STOR filename: Used to store (that is, put) a file into the current directory of the remote host. Electronic Mail in the Internet Electronic mail, commonly known as email, plays a fundamental role in communication on the Internet. Email operates within the application layer of the Internet protocol suite and allows users to send and receive messages electronically. Cont. E-Mail Components: User agent: Also known as an email client, it is the software used by the user to compose, send, receive, and manage email messages. Microsoft Outlook and Apple Mail are examples of user agents for e-mail Mail Server: Responsible for routing and transferring email messages between servers. Examples include Postfix, Send mail, and Microsoft Exchange. SMTP: Receives incoming messages from the MTA and stores them in the recipient's mailbox until they are retrieved by the MUA. Simple Mail Transfer Protocol (SMTP) SMTP is the principal application-layer protocol for Internet electronic mail. It uses reliable data transfer service of TCP to transfer mail from the sender’s mail server to the recipient’s mail server. SMTP transfers messages from senders’ mail servers to the recipients’ mail servers. 1982, SMTP is much older than HTTP. Comparison with HTTP Both protocols are used to transfer files from one host to another: HTTP transfers files from a Web server to a Web client (typically a browser); SMTP transfers files from one mail server to another mail server. SMTP operates over port 25. HTTP Operates over port 80. Involves the exchange of email messages between mail servers, focusing on email delivery. Facilitates the transfer of web content (HTML pages, images, scripts) between web servers and clients, enabling the browsing of web pages. Mail Access Protocols Mail Access Protocols are used to retrieve email messages from a mail server to a client device. POP3 (Post Office Protocol Version 3) IMAP (Internet Message Access Protocol) POP3 (Post Office Protocol Version 3) POP3 is one of the most widely used mail access protocols. It allows an email client to download email messages from a mail server to the local device. By default, POP3 downloads emails to the device and typically deletes them from the server. Internet Message Access Protocol (IMAP) • IMAP is a more advanced mail access protocol compared to POP. • IMAP allows users to view emails stored on the server without downloading them. • It syncs the email client with the server, maintaining the same mailbox structure across multiple devices. • IMAP is suitable for users who access emails from multiple devices. Web-Based E-Mail Hotmail introduced Web-based access in the mid 1990s Web-based email, also known as webmail, refers to email services that can be accessed via a web browser on any device with an internet connection. Users can log in to their email accounts through a web interface provided by the email service provider to send, receive, and manage emails. Some popular web-based email services include Gmail, Outlook.com, Yahoo Mail. Section 4. DNS—The Internet’s Directory Service We human beings can be identified in many ways. For example, we can be identified by the names that appear on our birth certificates. We can be identified by our social security numbers We can be identified by our driver’s license numbers Internet Host: One identifier for a host is its hostname. For Example: www.yahoo.com hosts are also identified by so-called IP addresses For Example: 192.168.0.1 con.t. The DNS is: a distributed database implemented in a hierarchy of DNS servers an application-layer protocol that allows hosts to query the distributed database The DNS protocol runs over UDP and uses port 53. Services Provided by DNS Host aliasing: a complex hostname may have a more simple alias and this converting process is provided by the DNS. Mail server aliasing: the MX record permits a company's mail server and Web server to have identical (aliased) hostnames. Load distribution: DNS is used to perform load distribution among replicated server How DNS Works DNS is an Application Layer Protocol which is used translate a hostname to an IP address. A centralized database in a single DNS server doesn't scale. So, it is distributed by design. A Distributed, Hierarchical Database In order to deal with the issue of scale, the DNS uses a large number of servers, organized in a hierarchical fashion and distributed around the world. No single DNS server has all of the mappings for all of the hosts in the Internet. there are three classes of DNS server 1. Root DNS servers: 2. Top Level Domain (TLD) DNS Servers 3. Authoritative DNS servers Portion of the hierarchy of DNS servers 1. Root DNS servers: In the Internet there are 13 root DNS server (labeled A through M), most of which are located in North America. For example, a.root-server.net, b.root-server.net, etc. Root servers are controlled by various organizations and this control has been delegated to these organizations by ICANN (Internet Assigned Names and Numbers). 2. Top Level Domain (TLD) DNS Servers These domains are located one level below the root domain. Names like af, us, uk, com, net, org, .... are the top names. Today there are more than 800 domains on the Internet. Top Level Domain will be divided into different categories. 1. TLD General (.edu, .gov, .net, .com, .org...) 2. TLD affiliate countries (.af, .uk.,us...) 3. TLDs are specific brands (.microsoft, .linux...) 4. TLD Integrated Infrastructure (arpa.) 3.Authoritative DNS servers Authoritative DNS servers are the servers that store and provide DNS information (such as IP addresses associated with domain names) for a specific domain. They are the final authority on DNS information for a given domain. Most universities and large companies implement and maintain their own primary and secondary (backup) authoritative DNS server. local DNS server A local DNS server, also known as a caching DNS server or a recursive DNS server, is a server that is typically set up within a local network environment to handle DNS queries from devices within that network. These servers help improve network performance, security, and privacy by resolving domain names to IP addresses for devices on the local network. Interaction of the various DNS servers DNS Caching DNS cache is a temporary database maintained by a computer's operating system that stores records of recent DNS lookups. When you visit a website, your computer needs to look up the IP address associated with the domain name. This process can take some time, so to speed it up, the operating system stores this information in the DNS cache for future use. DNS exploits DNS caching in order to improve the delay performance and to reduce the number of DNS messages ricocheting around the Internet. DNS Records and Messages A resource record is a four-tuple that contains the following fields: Name: it depends on the type. Value: it depends on the type. Type: A, NS, CNAME, MX. TTL: it determines when a resource should be removed from a cache. Cont. If Type=A, then Name is a hostname and Value is the IP address for the hostname. Thus, a Type A record provides the standard hostname-to-IP address mapping. If Type=NS, then Name is a domain (such as foo.com) and Value is the hostname of an authoritative DNS server that knows how to obtain the IP addresses for hosts in the domain. If Type=CNAME, then Value is a canonical hostname for the alias hostname Name. This record can provide querying hosts the canonical name for a hostname. If Type=MX, then Value is the canonical name of a mail server that has an alias hostname Name. DNS Messages There are only two types of DNS messages: Query message. Reply message. both query and reply messages have the same format. header section: Contains important information such as the operation code, response flag, number of questions, answer records, authority records, and additional records question section: Contains one or more questions that the client is asking the DNS server. answer section: Contains the records that answer the questions in the query section. Cont. authority section: Contains records that point to authoritative name servers for the queried domain. additional section: Contains additional records that might be useful to the client in processing the response, such as glue records (IP addresses of authoritative name servers). Inserting Records into the DNS Database Inserting records into a DNS database typically involves configuring a DNS server with the necessary resource records to map domain names to corresponding IP addresses or other information. Here are the basic steps involved in inserting records into a DNS database. 1. Access DNS Server Configuration: Access the configuration interface of your DNS server. This could be a web-based interface, a command-line tool, or a configuration file, depending on the DNS server software you are using (e.g., BIND, Microsoft DNS, etc.). 2. Choose the Record Type: Determine the type of DNS record you want to insert. Common types include: A record, AAAA record, CNAME record, MX record Cont. 3. Add the Record: Depending on the DNS server software, you will need to provide the following information: Name: The domain name for which you are adding the record. Type: The type of DNS record being added (A, AAAA, CNAME, MX, TXT, etc.). Data: The value associated with the record (e.g., IP address for an A record, mail server address for an MX record). TTL: The Time to Live value for the record (how long the record can be cached). 4. Save Changes: After adding the record, save the changes in the DNS server configuration. Peer-to-Peer Applications P2P architecture, there is minimal (or no) reliance on always-on infrastructure servers. Instead, pairs of intermittently connected hosts, called peers, communicate directly with each other. Two types of P2P Application: 1. File Distribution (BitTorrent system) 2. Database Distribution (Distributed Hash Table (DHT)) P2P File Distribution In P2Pfile distribution, each peer can redistribute any portion of the file it has received to any other peers. the most popular P2P file distribution protocol is BitTorrent. we first examine the self scalability of P2Parchitectures in the context of file distribution. We then describe BitTorrent in some detail, Scalability of P2P Architectures BitTorrent BitTorrent is a popular P2P protocol for file distribution. In BitTorrent lingo, the collection of all peers participating in the distribution of a particular file is called a torrent.