Chapter 6 - Application Layer PDF

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Document Details

Tags

application layer networking computer networks protocols

Summary

This document explains the application layer in computer networks. It describes network applications, fundamental concepts, and the communication between different processes in a network.

Full Transcript

Chapter -6 Application Layer Network Applications Email Web Remote Login P2P File Sharing Multi-user Network Games Streaming Stored Video (YouTube) Voice Over IP (Skype) Real-time Video Conference Social Networking Principles of Network Applications These are fundamental conc...

Chapter -6 Application Layer Network Applications Email Web Remote Login P2P File Sharing Multi-user Network Games Streaming Stored Video (YouTube) Voice Over IP (Skype) Real-time Video Conference Social Networking Principles of Network Applications These are fundamental concepts that govern the design and development of applications that run on a computer network. It includes: Network Application Architectures refer to the overall design and structure of a network application. Processes Communicating refers to the communication between multiple processes in a computer network. The Interface Between the Process and the Computer Network refers to the connection between a process running on a device and the underlying computer network. Continue… Transport Services Available to Applications are the services provided by the network stack that enable applications to communicate with each other over a computer network. Transport Services Provided by the Internet The Internet provides two primary transport services for applications: TCP and UDP. Application-Layer Protocols are data exchange protocols used to allow communication between applications on different devices. Principles of Network Applications The application layer in the OSI model is the closest layer to the end user which means that the application layer and end user can interact directly with the software application. A network application development is writing programs that run on different end systems and communicate with each other over the network. In the Web application there are two different programs that communicate with each other: Browser program running in the user's host. Web server program running in the Web server host. Hos Hos t t Network Application Architecture Client – Server Architecture Client/Server network is a network model designed for the end users called clients, to access the resources such as songs, video, etc. from a central computer known as Server. The central controller is known as a server while all other computers in the network are called clients. A server performs all the major operations such as security and network management. A server is responsible for managing all the resources such as files, directories, printer, etc. All the clients communicate with each other through a server. For example, if client1 wants to send some data to client 2, then it first sends the request to the server for the permission. The server sends the response to the client 1 to initiate its communication with the client 2. Example : Email , Database. Peer-To-Peer Network Peer-To-Peer network is a network in which all the computers are linked together with equal privilege and responsibilities for processing the data. Peer-To-Peer network is useful for small environments, usually up to 10 computers. Peer-To-Peer network has no dedicated server. Special permissions are assigned to each computer for sharing the resources, but this can lead to a problem if the computer with the resource is down. Example : File sharing (BitTorrent), VOIP (Skype), Online gaming. Process Communicating What is Process? A process is an instance of a program running in a computer. We can say that process is program under execution. Within same host, two processes communicate using inter-process communication (IPC). Process in different hosts communicate by exchanging messages. Client process: A process that initiates communication. Server process: A process that waits to be contacted. Socket A process sends messages into and receives messages from; the network through a software interface called a socket. A process is like a house and its socket is like its door. Sending process passes message outdoor. Sending process relies on transport infrastructure on other side of door to deliver message to socket at receiving process. Process application application proce socket proce controlled by ss ss app developer transport transport network network controlled link by OS link Internet Socket physical physical Transport Services to Applications Recall that a socket is the interface between the application process and the transport layer protocol. To develop an application, choose available transport layer protocol. Pick the protocol with the services that best match the needs of your application. Example: Choose either Train or Airplane transport for travel between two cities. Classify services with four parameters: Reliable Data Throughput Timing Security Transfer Transport Services to Applications Reliable Data Transfer: Many applications (e.g., email, file transfer, financial applications) require 100% reliable data transfer Required guarantee that data sent by one end of application is delivered correctly and completely to the other end of application. This guaranteed data delivery service is called Reliable Data Transfer. When it will fail to deliver reliable data transfer, it is acceptable for loss-tolerant applications. Loss-tolerant Applications (e.g., audio/video) can tolerate some loss. Transport Services to Applications Throughput Some apps (e.g., multimedia) require at least amount of throughput to be “effective” Bandwidth sensitive application, specific throughput required. Timing some apps (e.g., Internet telephony, interactive games) require low delay to be “effective” Security In the sending host, encrypt all data transmitted by the sending process. In the receiving host, decrypt the data before delivering the data to the receiving process. Internet Transport Protocols Services TCP Service: UDP Services: Connection-Oriented: A setup required between Connectionless: No connection before two client and server processes processes start to communicate. Reliable data transfer between sending and Unreliable data transfer between sending and receiving process without error and proper order receiving process Congestion control: To control sender when It does not provide congestion control. network overloaded It Does not provide. Reliability, flow control, Applications that require reliable data delivery, throughput guarantee, security. Applications such as email or file transfer, typically use TCP. that require low latency or high speed, such as video streaming or online gaming, typically use UDP. Application Layer Protocols Popular internet applications with their application layer and their underlying transport protocol. Application-Layer Underlying Transport Applications Protocol Protocol (Service) Email SMTP TCP Remote Terminal Telnet TCP Access Web HTTP TCP File Transfer FTP TCP Streaming Media HTTP(YouTube), RTP TCP or UDP Internet Telephony SIP, RTP(Skype) Typically UDP No loss, Elastic Loss-tolerant Bandwidth Application Layer Protocols FTP HTTP/HTTPS SMTP DNS POP Web & HTTP Early 1990, Internet was used only by researchers, academics, and university students. New application WWW arrived in 1994 by Tim Berners-Lee. World Wide Web - is an information where documents and other web resources are identified by URL, interlinked by hypertext links, and can be accessed via the Internet. On demand available, What they want, When they want it. Unlike TV and Radio. Navigate through Websites. Web & HTTP Web page consists of objects. Object can be HTML file, JPEG image, Java applet, audio file etc.… Web page consists of base HTML-file which includes several referenced objects. Each object is addressable by a Uniform Resource Locator (URL), like; www.charusat.ac.in/AIML Dept/pic.gif host name path name HTTP Have you thought about what happens when we enter a URL (Uniform Resource Locator) in the browser to visit a website? The browser fetches the IP address corresponding to the entered URL using DNS (Domain Name System). Once the browser gets the IP address corresponding to the entered URL, the browser sends a request to the server at the backend (along with the IP address of the website) to fetch the webpage of the website. In return, the browser receives a response from the server and this response contains the HTML (Hypertext Markup Language) information of the webpage. This exchange of information between the browser and the server takes place on an HTTP connection. HTTP Protocol HTTP Hyper-Text Transfer Protocol It is Application layer protocol Client: A browser that requests receives, (using HTTP protocol) and “displays” Web objects. E.g. PC, Mobile Server: Web server sends (using HTTP protocol) objects in response to requests. E.g. Apache Web Server HTTP Protocol (Continue..) A client initiates TCP connection (creates socket) to server using port 80. A server accepts TCP connection from client. HTTP messages (application-layer protocol messages) exchanged between browser (HTTP client) and Web server (HTTP server). HTTP is “stateless protocol”, server maintains no information about past client requests. HTTP connection types are: Non-persistent HTTP Persistent HTTP Non-persistent HTTP & Persistent HTTP Connection Non-persistent & Persistent Connection In Client-Server communication, Client making a series of requests to server, Server responding to each of the requests. Series of requests may be made back-to-back or periodically at regular time interval. So, Application developer need to make an important decision; Should each request/response pair be sent over a separate TCP connection. OR should all the requests and corresponding responses be sent over same TCP connection? Non-persistent HTTP A non-persistent connection is closed after the server sends the requested object to the client. The connection is used exactly for one request and one response. For downloading multiple objects, it required multiple connections. Non-persistent connections are the default mode for HTTP/1.0. Example: Transferring a webpage from server to client, webpage consists of a base HTML file and 10 JPEG images. Total 11 object are residing on server. Non-persistent HTTP – Cont.… URL: www.someSchool.edu/someDepartment/home.index 1a. HTTP client initiates TCP connection to HTTP server (process) at 1b. HTTP server at host www.someSchool.edu on port 80 www.someSchool.edu waiting for TCP connection at port 80. “accepts” 2. HTTP client sends HTTP request connection, notifying client message (containing URL) into TCP 3. HTTP server receives request connection socket. Message indicates message, forms response message that client wants object containing requested object, and someDepartment/home.index sends message into its socket 4. HTTP server closes TCP connection. 5. HTTP client receives response message containing html file, displays html. Parsing html file, finds 10 referenced jpeg objects 6. Steps 1-5 repeated for each of 10 jpeg objects Time Non-persistent HTTP: Response time RTT(round-trip time): A time for a small packet to travel from client to server and vice versa. HTTP response time: One RTT to initiate TCP connection. One RTT for HTTP request and first few bytes of HTTP response to return. File transmission time initiate TCP connection Non-persistent HTTP response time RTT = request file 2RTT time to RTT + transmit file file transmission time file received time time Persistent HTTP Server leaves the TCP connection open after sending responses. Subsequent HTTP messages between same client and server sent over open connection. The server closes the connection only when it is not used for a certain configurable amount of time. It requires as little as one round-trip time (RTT) for all the referenced objects. With persistent connections, the performance is improved by 20%. Persistent connections are the default mode for HTTP/1.1. HTTP Message Format Two types: 1. Request Message 2. Response Message HTTP Request Message It is in ASCII format which means that human-readable format. HTTP request message consist three part: Request line Header line Carriage return carriage return character line-feed character request line (GET, POST, GET /index.html HTTP/1.1\r\n HEAD commands) Host: www-net.cs.umass.edu\r\n User-Agent: Firefox/3.6.10\r\n Accept: heade text/html,application/xhtml+xml\r\n r Accept-Language: en-us,en;q=0.5\r\n lines Accept-Encoding: gzip,deflate\r\n carriage return Accept-Charset: ISO-8859-1,utf-8;q=0.7\r\n (line feed at start Keep-Alive: 115\r\n Connection: keep-alive\r\n of line indicates \r\n end of header lines) HTTP Request Message - Format The request line has three fields: Method field, URL field, and HTTP version field. The method field can take on several different values, including GET, POST, HEAD, PUT, and DELETE. In above message, browser is requesting the object /somedir/page.html and version is self-explanatory; browser implements version HTTP/1.1. The header line Host: www-net.cs.umass.edu specifies the host on which the object resides. User agent indicate browser name and version. HTTP Response Message HTTP response message consist of three part: 1. Status line 2. Header line 3. Data (Entity body) status line HTTP/1.1 200 OK\r\n (protocol Date: Sun, 26 Sep 2010 20:09:20 GMT\r\n status code Server: Apache/2.0.52 (CentOS)\r\n status phrase) Last-Modified: Tue, 30 Oct 2007 17:00:02 GMT\r\n heade ETag: "17dc6-a5c-bf716880"\r\n r Accept-Ranges: bytes\r\n Content-Length: 2652\r\n lines Keep-Alive: timeout=10, max=100\r\n Connection: Keep-Alive\r\n Content-Type: text/html; data, e.g., charset=ISO-8859-1\r\n requested \r\n HTML file data data data data data... HTTP Response Message - Format The status line has three fields: protocol version field, status code and corresponding status message. In below example, the status line indicates that the server is using HTTP/1.1 and that everything is OK. HTTP/1.1 200 OK\r\n Date: Sun, 26 Sep 2010 20:09:20 GMT\r\n Server: Apache/2.0.52 (CentOS)\r\n Last-Modified: Tue, 30 Oct 2007 17:00:02 GMT\r\n ETag: "17dc6-a5c-bf716880"\r\n Accept-Ranges: bytes\r\n Content-Length: 2652\r\n Keep-Alive: timeout=10, max=100\r\n Connection: Keep-Alive\r\n Content-Type: text/html; charset=ISO-8859-1\r\n \r\n data data data data data... Date: header Content-Type: Server: Last-Modified: Content-Length: header line indicates header header header line line the indicates line line timethat indicates indicatesand thatdate the the thethewhen number time the message object and HTTP ofinbytes date was the response generated when in entity was the the byiscreated object bodyobject being an HTML and Apache wassent. text.sent Webby created or the lastserver. server. modified. HTTP Response Status Codes A status code appears in 1st line in server-to-client response message. Some sample codes: 200 OK Request succeeded, requested object later in this message 301 Moved Permanently Requested object moved, new location specified later in this message(Location) 400 Bad Request Request message not understood by server 404 Not Found Requested document not found on this server 505 HTTP Version Not Supported Requested http version not support Domain Name System (DNS) The Domain Name System (DNS) is like the internet’s phone book. DNS is a distributed database implemented in a hierarchy of name servers. It is an application layer protocol for message exchange between clients and servers. What is the Need for DNS? Every host is identified by the IP address but remembering numbers is very difficult for people also the IP addresses are not static therefore a mapping is required to change the domain name to the IP address. So DNS is used to convert the domain name of the websites to their numerical IP address. Types of Domain There are various kinds of domains: Generic Domains:.com(commercial),.edu(educational),.mil(military),.org(nonprofit organization),.net(similar to commercial) all these are generic domains. Country Domain:.in (India).us.uk Organization of Domain It is very difficult to find out the IP address associated with a website because there are millions of websites and with all those websites we should be able to generate the IP address immediately, there should not be a lot of delays for that to happen organization of the database is very important. Domain Name Server The client machine sends a request to the local name server, which, if the root does not find the address in its database, sends a request to the root name server, which in turn, will route the query to a top-level domain (TLD) or authoritative name server. The root name server can also contain some hostName to IP address mappings. The Top-level domain (TLD) server always knows who the authoritative name server is. So finally the IP address is returned to the local name server which in turn returns the IP address to the host. The Steps in a DNS Lookup? Here is an example of all 8 steps when nothing is cached: 1. A user types “example.com” into a web browser. 2. The request goes to a DNS resolver. 3. The resolver asks a root server where to find the top-level domain (TLD) server for.com. 4. The root server tells the resolver to contact the.com TLD server. 5. The resolver then asks the.com TLD server for the IP address of “example.com.” 6. The.com TLD server gives the resolver the IP address of the domain’s nameserver. 7. The resolver then asks the domain’s nameserver for the IP address of “example.com.” 8. The domain’s nameserver returns the IP address to the resolver. What is DNS Resolver? DNS Resolver is simply called a DNS Client and has the functionality for initiating the process of DNS Lookup which is also called DNS Resolution. By using the DNS Resolver, applications can easily access different websites and services present on the Internet by using domain names that are very much friendly to the user and that also resolves the problem of remembering IP Address. File Transfer Protocol (FTP) FTP or File Transfer Protocol is said to be one of the earliest and also the most common forms of transferring files on the internet. FTP is a basic system that helps in transferring files between a client and a server. It makes the FTP unique that the system provides a reliable and efficient means of transferring files from one system to another even if they have different file structures and operating systems. Uses of FTP FTP is especially useful for: Transferring Large Files: FTP can transfer large files in one shot; thus applicable when hosting websites, backing up servers, or sharing files in large quantities. Remote File Management: Files on a remote server can be uploaded, downloaded, deleted, renamed, and copied according to the users’ choices. Automating File Transfers: FTP is a great protocol for the execution of file transfers on predefined scripts and employments. Accessing Public Files: Anonymous FTP means that everybody irrespective of the identity is allowed to download some files with no permissions needed. Types of Connection in FTP Control Connection : For sending control information like user identification, password, commands to change the remote directory, commands to retrieve and store files, etc., FTP makes use of a control connection. The control connection is initiated on port number 21. Data connection : For sending the actual file, FTP makes use of a data connection. A data connection is initiated on port number 20. FTP sends the control information out-of-band as it uses a separate control connection. Some protocols send their request and response header lines and the data in the same TCP connection. For this reason, they are said to send their control information in-band. HTTP and SMTP are such examples. How to Use FTP To use FTP, follow these steps: Connect to the FTP Server: One can connect to the server using the address, username and password through an FTP client or a command line interface. Anonymous Information may not need a username and password. Navigate Directories: Some commands include ls that is used to list directories and cd that is used to change directories. Transfer Files: File transfer may be done by using the commands such as get for downloading files, and put for uploading files. Manage Files: Make operations like deletion (Delete), renaming (Rename) as well as copying (Copy) of files. Close the Connection: Once file transfer has been accomplished, terminate the connection by giving the bye or quit command. Simple Mail Transfer Protocol (SMTP) SMTP stands for Simple Mail Transfer Protocol. SMTP is a set of communication guidelines that allow software to transmit an electronic mail over the internet is called Simple Mail Transfer Protocol. It is an essential component of the email communication process and operates at the application layer of the TCP/IP protocol stack. The client who wants to send the mail opens a TCP connection to the SMTP server and then sends the mail across the connection. The SMTP server is an always-on listening mode. As soon as it listens for a TCP connection from any client, the SMTP process initiates a connection through port 25. After successfully establishing a TCP connection the client process sends the mail instantly. Components of SMTP Mail User Agent (MUA): It is a computer application that helps you in sending and retrieving mail. It is responsible for creating email messages for transfer to the mail transfer agent(MTA). Mail Submission Agent (MSA): It is a computer program that receives mail from a Mail User Agent(MUA) and interacts with the Mail Transfer Agent(MTA) for the transfer of the mail. Mail Transfer Agent (MTA): It is software that has the work to transfer mail from one system to another with the help of SMTP. Mail Delivery Agent (MDA): A mail Delivery agent or Local Delivery Agent is basically a system that helps in the delivery of mail to the local system. Components of SMTP First, we will break the SMTP client and SMTP server into two components such as user agent (UA) and mail transfer agent (MTA). The user agent (UA) prepares the message, creates the envelope and then puts the message in the envelope. The mail transfer agent (MTA) transfers this mail across the internet. Components of SMTP (Continue..) SMTP allows a more complex system by adding a relaying system. Instead of just having one MTA at sending side and one at receiving side, more MTAs can be added, acting either as a client or server to relay the email. Working of SMTP Composition of Mail: A user sends an e-mail by composing an electronic mail message using a Mail User Agent (MUA). Mail User Agent is a program which is used to send and receive mail. The message contains two parts: body and header. The body is the main part of the message while the header includes information such as the sender and recipient address. The header also includes descriptive information such as the subject of the message. In this case, the message body is like a letter and header is like an envelope that contains the recipient's address. Working of SMTP (Continue..) Submission of Mail: After composing an email, the mail client then submits the completed e-mail to the SMTP server by using SMTP on TCP port 25. Delivery of Mail: E-mail addresses contain two parts: username of the recipient and domain name. For example, [email protected], where "vivek" is the username of the recipient and "gmail.com" is the domain name. Working of SMTP (Continue..) If the domain name of the recipient's email address is different from the sender's domain name, then MSA will send the mail to the Mail Transfer Agent (MTA). To relay the email, the MTA will find the target domain. It checks the MX record from Domain Name System to obtain the target domain. The MX record contains the domain name and IP address of the recipient's domain. Once the record is located, MTA connects to the exchange server to relay the message. Receipt and Processing of Mail: Once the incoming message is received, the exchange server delivers it to the incoming server (Mail Delivery Agent) which stores the e-mail where it waits for the user to retrieve it. Access and Retrieval of Mail: The stored email in MDA can be retrieved by using MUA (Mail User Agent). MUA can be accessed by using login and password. POP (Post Office Protocol) POP stands for Post Office Protocol. POP has been updated two times namely “POP2” and “POP3”. The POP protocol is an Internet Standard Protocol that works on the application layer. It is used to get an access email from the mail server. The need for POP mainly arises when the user or client does not have a continuous internet connection and what’s to receive email messages. The Pop client makes use of POP to pull email messages from the POP server. POP3 is the updated version of POP. What is POP3? POP3 protocol is used to provide access to the mail inbox that is stored in the email server. POP3 protocol can download and delete messages. Once the POP3 client has established a connection with the mail server it can easily retrieve all the messages from the server. Working of POP3 Protocol To establish the connection between the POP3 server and the POP3 client, the POP3 server asks for the user name to the POP3 client. If the username is found in the POP3 server, then it sends the ok message. It then asks for the password from the POP3 client; then the POP3 client sends the password to the POP3 server. If the password is matched, then the POP3 server sends the OK message, and the connection gets established. After the establishment of a connection, the client can see the list of mails on the POP3 mail server. In the list of mails, the user will get the email numbers and sizes from the server. Working of POP3 Protocol (Continue..) Once the client retrieves all the emails from the server, all the emails from the server are deleted. Therefore, we can say that the emails are restricted to a particular machine, so it would not be possible to access the same mails on another machine. This situation can be overcome by configuring the email settings to leave a copy of mail on the mail server.

Use Quizgecko on...
Browser
Browser