You now have a basic idea about how communication takes place between a Web server and a Web browser. To connect to a Web server, you need to specify a valid URL. A Web browser installed on the client computer uses a Uniform Resource Locater (URL) to send a request to the server. This URL contains a unique domain name that distinguishes one site from another. For example, to access the FAQ posted on Apache’s official Web site, you specify the URL, http://www.apache.org:80/faq.html. You can further split this URL into these four parts:
- Protocol. The URL begins with the protocol specification that will be used to communicate on the network. In the preceding URL, the HyperText Transfer Protocol (HTTP) is used. HTTP is the most commonly used protocol for communication on the Web.
- Server name. Followed by the protocol, the URL specifies the server name, which in this case is www.apache.org.
- Port. The port number is specified after the server name and is preceded by a colon. If not specified, the port number defaults to 80 for all HTTP requests that are sent to the Web server.
- Filename. After specifying the name of the server, you can also specify the name of the file that you want to view. In this case, the name of the file is faq.html. You can also specify the complete path name if the file that you want to view is in a different location.
Now that you have an idea of how a Web browser communicates with Web servers, peek into the internal workings of a Web server that facilitates the Web page to be viewed in the browser of the client computer. Here is the process:
- While sending the requests, the browser converts the server name (http://www.apache.org) to an IP address. The browser connects to the server using this IP address.
- After establishing a connection with the server using its IP address, the client computer sends requests to the server. The connection is established on port 80, which is, by convention, reserved for HTTP transactions taking place in a network.
- The request that is sent by the client is typically a GET request. The GET request then asks for the file named faq.html.
- After the Web server accepts the request for the file, the corresponding content of the file is sent to the client requesting the page. In this case, the content is HTML text.
- The browser on the client computer interprets the HTML text and displays the Web page. The Web browser formats the page in accordance with the HTML tags present in the source of the HTML file.