Full Transcript

King Fahd University of Petroleum & Minerals College of Computer Science & Engineering Information & Computer Science Department ICS 343 Fundamentals of Computer Networks Standard Client-Server Protocols These slides are based on: Chapter...

King Fahd University of Petroleum & Minerals College of Computer Science & Engineering Information & Computer Science Department ICS 343 Fundamentals of Computer Networks Standard Client-Server Protocols These slides are based on: Chapter 26, Data Communications and Networking, 5th Edition Outline ◼ Introduction ◼ 26.1 World-Wide Web (WWW) and HTTP ◼ 26.2 FTP ◼ 26.3 Electronic Mail ◼ 26.5 Secure Shell (SSH) ◼ 26.6 Domain Name System (DNS) Introduction ◼ The application layer provides services to the user. ◼ To use the Internet, we need two application programs to interact with each other (two computers each one in a different location). ◼ The two programs need to send messages to each other through the Internet infrastructure. ◼ Two paradigms have been developed: ◼ Client-server paradigm ◼ Peer-to-Peer paradigm. Client-Server Paradigm ◼ Consists of two parts: a client and a server. ◼ A client is a program running at the client’s end that initializes the communication by sending a request. ◼ A server is another application program that waits for a request from a client which is running on another location. Example of a client-server paradigm 26-1 WORLD WIDE WEB (WWW) AND HTTP ◼ The idea of the Web was first proposed in 1989 at CERN, the European Organization for Nuclear Research. ◼ The goal is to allow several researchers at different locations throughout Europe to access each others’ research. ◼ The commercial Web started in the early 1990s. WWW is a client-server service, in which a client using a browser can access a service from a server. ◼ The service provided is called sites, each site holds one or more web pages. Example 26.1 ◼ Assume we need to retrieve a scientific document (file A) that contains ◼ one reference to a large image (file B), ◼ one reference to another text file (file C) in another site Web Client (Browser) (Web Server) (Web Server) WORLD WIDE WEB (WWW) ◼ Web Client (browser) ◼ Controller ◼ Client protocols (HTTP, FTP, SSH, SMTP) ◼ Interpreters (HTML, JavaScript, Java) ◼ Web Server ◼ The webpage is stored at the server. ◼ Responses to the incoming request Uniform Resource Locator (URL) ◼ A web page, as a file, needs to have a unique identifier to distinguish it from other web pages. ◼ To define a web page, we need three identifiers: host, port, and path. ◼ Host: the IP address of the server or the unique name given to the server. (for the name we need DNS) ◼ Port: a 16-bit integer, is normally predefined for the client-server application. For example, port 80 is used in HTTP protocol for accessing the web page. ◼ Path: identifies the file’s location and name in the underlying operating system. The format depends on the operating system. ◼ Before defining the web page, an abbreviation of the protocol is needed to tell the browser what client-server application we want to use. ◼ HTTP (HyperText Transfer Protocol), ◼ FTP (File Transfer Protocol). Uniform Resource Locator (URL) ◼ Combining the four pieces together we get Uniform Resource Locator (URL): ◼ Example 26.2 ◼ The URL http://www.mhhe.com/compsci/forouzan/ Web Document ◼ The documents in WWW can be grouped into three broad categories: ◼ Static documents ◼ Dynamic documents ◼ Active documents 26.2 HyperText Transfer Protocol (HTTP) ◼ HTTP is used to define (the rules) how the client- server programs can be written to retrieve web pages from the Web. ◼ client sends a request; ◼ server returns a response. ◼ server uses the port number 80; ◼ client uses a temporary port number. ◼ HTTP uses the services of TCP, which is a connection- oriented and reliable protocol. 26.2 HyperText Transfer Protocol (HTTP) ◼ Uses TCP: 1. client initiates TCP connection to the server, port 80 2. server accepts TCP connection from client 3. HTTP (application-layer) messages exchanged between the HTTP client and HTTP server 4. TCP connection is closed ◼ Two methods ◼ Nonpersistent Connections ◼ Persistent Connections Nonpersistent Connection ◼ In a nonpersistent connection, one TCP connection is made for each request/response. ◼ The following lists the steps in this strategy: 1. The client opens a TCP connection and sends a request. 2. The server sends the response and closes the connection. 3. The client reads the data until it encounters an end-of-file marker; it then closes the connection. Example 26.3: Nonpersistent Connection Example 26.3: Nonpersistent Connection Example 26.3: Nonpersistent Connection Example 26.3: Nonpersistent Connection Persistent Connection ◼ In a persistent connection: ◼ The server leaves the connection open for more requests after sending a response. ◼ The server can close the connection at the request of a client or if a time-out has been reached. The sender usually sends the length of the data with each response. ◼ Time and resources are saved using persistent connections. ◼ Only one set of buffers and variables needs to be set for the connection at each site. Example 26.4: Persistent Connection Example 26.4: Persistent Connection Example 26.4: Persistent Connection Example 26.4: Persistent Connection Example 26.4: Persistent Connection Formats of the request and response messages 26.25 Methods 26.26 HTTP Status Codes ◼ Success 2xx ◼ Redirection 3xx ◼ Error 4xx, 5xx Request Header Names Response Header Names Example 26.5 Example 26.6 Cookies ◼ Today the Web has other functions that need to remember some information about the clients. ◼ Websites are being used as electronic stores that allow users to browse through the store, select wanted items, put them in an electronic cart, and pay at the end with a credit card. ◼ Remember login details. ◼ Visitors counter. ◼ Some websites are just advertising agencies ◼ For these purposes, the cookies were introduced. Cookies ◼ The creation and storage of cookies depend on the implementation; however, the principle is the same. ◼ When a server receives a request from a client, it stores information about the client in a file or a string, such as ◼ The domain name of the client ◼ Registration number ◼ A timestamp ◼ The server includes the cookie in the response that it sends to the client. ◼ When the client receives the response, the browser stores the cookie in the cookie directory, which is sorted by the server domain name. Example ◼ session-id-time 954242000 amazon.com/ session- id 002-4135256-7625846 amazon.com/ x-main eKQIfwnxuF7qtmX52x6VWAXh@Ih6Uo5H amazon.com/ ubid-main 077-9263437-9645324 amazon.com/ Example 26.8 Next lecture ◼ Introduction ◼ 26.1 World-Wide Web (WWW) and HTTP ◼ 26.2 FTP ◼ 26.3 Electronic Mail ◼ 26.5 Secure Shell (SSH) ◼ 26.6 Domain Name System (DNS) Important to do at home : - Read chapter 26 of the textbook

Use Quizgecko on...
Browser
Browser