Monday, August 13, 2007

Basics of Web Server

Web servers are based on client-server concept. The client(usually your browser) , sends a request to the server, which can understand the client's request and sends the expected answer back to the client. Lets imagine that the client requests for a static web page http://www.yahoo.com/index.html . This is called the URL(Uniform Resource Locator) of the requested resource. Your browser establishes a connection with a web server and gets you the required page. Now what actually happened in the background?
The URL consists of 3 parts
  • The protocol (http - hyper text transfer protocol)
  • The server name (www.yahoo.com)
  • The required resource(index.html)
This means using a certain protocol(http), fetch me a file called "index.html" on the computer "www" from the domain "yahoo.com". The browser first contacts a DNS(Domain Name Service) server to translate the server name "www.yahoo.com" into an IP Address(87.248.113.14) which is used to communicate to the corresponding server machine. The browser will then establish a connection to the server at that IP Address on port 80(Corresponding to the http protocol - There are several ports in a server corresponding to different protocols and are used for different purposes). Then the browser follows the http protocol and sends the GET request to the server requesting for the file "index.html". The server then sends the HTML text for the requested page to the browser. The browser will then read the HTML tags and present the data in a readable format. So you have finally got the page you requested for and a client-server transaction is said to be complete. These are just the basic stuff. I will keep posting regularly with more technical stuff.