A Web browser/server are examples of a client/server computer system. The client requests services, the server provides the services. Each follows a strict protocol that defines the rules for interactions between the client and server.
URL - Universal Resource Locator. Specifies a unique identifier to a file located on a server. The URL http://www.ius.edu/rwisman/Hello.htm specifies:
- HTTP protocol
- Server www.ius.edu
- File rwisman/Hello.htm
Other protocols can be specified in a URL.
For example email can be specified using the URL mailto:email@example.com which would open the email client on a Windows machine with the email address firstname.lastname@example.org.
In HTML it would be written as <a href="mailto:email@example.com>Ray Wisman</a> and appears in a browser as Ray Wisman.
Client - A computer that accesses shared network resources provided by another computer, called a server. An Internet client application is a program that accesses information from a network data source (server) using Internet protocols such as gopher, FTP, or HTTP. An Internet client application might access a server to retrieve data such as weather maps, stock prices, or newspaper headlines, for example. The Internet client can access the server through an external network (the Internet) or an internal network (sometimes called an intranet).
Web browsers are a common Internet client, providing a graphical interface to resources stored on a Web server. The relationship of a client and server is illustrated by the following diagram. The communication exchange is as follows:
- Client connects to a server at www.ius.edu.
- Client sends a request to server as rwisman/Hello.htm
- Server receives request, retrieves the file Hello.htm and copies the contents of the file back to the client.
- Client receives server response as the contents of file Hello.htm and renders the contents as Hello World.
Server - In general, refers to a computer that provides shared resources to network users. On a network, the computer running software that provides data and services to clients over the network. On the Internet, refers to a network data source using Internet protocols such as gopher, FTP, or HTTP. In the illustration above, the server provides file resources using the HTTP protocol.
HTTP - The rules for Web browser and server interaction are defined by the HyperText Transfer Protocol (HTTP). HTTP supports four basic operations that the browser can specify:
- GET requests a specific item from the server such as a file. The server returns a status heading, a blank line, followed by the item.
- HEAD requests item status, the server returns only the status.
- POST sends data to the server.
- PUT sends data to the server.
The communication exchange diagrammed above would be more accurately specified as an HTTP exchange.
- Client connects to the server www.ius.edu
- Client then sends a HTTP request:
GET /rwisman/Hello.htm HTTP/1.0
- Server receives request, retrieves the item Hello.htm and responds by returning status information (200 indicates the server honored the request) and copies the item contents of the file back to the client.
HTTP/1.1 200 OK
Date: Tue, 10 Apr 2001 03:37:48 GMT
Last-Modified: Tue, 10 Apr 2001 03:35:48 GMT
- Client receives server response and renders the <H1>Hello World</H1> as Hello World.
Web systems generally consist of a two or three tiered architecture:
- Client Browser - Requests Web pages from server and displays to user.
- Web Server - Delivers requested Web pages to client. Can dynamically construct pages from database based on user requests.
- Database Server - Maintains database and responds to Web server requests. Can be on same or different computer as Web server.
Web servers and clients adhere to the HTTP protocol for communication. Web servers generally listen for HTTP connections on the well-known port 80 and clients connect to port 80. Mail servers using SMTP (Simple Mail Transport Protocol) will listen on port 25 for SMTP connections, and terminal servers using TELNET on port 20.
A Web server running on machine www.ius.edu t waits for a client to connect on port 80. A client connects to www.ius.edu and port 80 to communicate using HTTP. Browsers by default use port 80 but can use other connection ports (e.g. http://www.ius.edu:6666 would use port 6666 instead of 80, although no server may be listening to port 6666). Other clients applications can also connect to port 80. For example TELNET normally uses port 20 but can connect to port 80. Since TELNET sends whatever you type to the server and displays whatever the server send back, it can be used as a crude browser, displaying the raw server response.
A browser sends HTTP to the server and the server sends back HTTP and some content such as HTML. The browser then renders the HTML so the browser user sees other than raw HTML. Using TELNET as a browser you need to type the browser HTTP request commands to send to the server and will get back the server response.
- Enter the following two lines at the command prompt.
- Line 1 runs TELNET to connect to the www.ius.edu port 80, the port on which the Web server listens.
- Line 2 (which doesn't display in the Windows 2000 Telnet) is the HTTP sent to the server requesting the default Web page to be returned.
- Line 3 is the blank line at the end of a HTTP command. The remainder is part of the server response.
Using TELNET as a Web Client
- telnet www.ius.edu 80
- GET / HTTP/1.0
HTTP/1.1 200 OK
Date: Tue, 07 May 2007 10:24:54 GMT
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<title>Indiana University Southeast</title>
Connection to host lost.
Exercise 0 - Mimic the Actions of a Browser using TELNET.