Showing posts with label IT. Show all posts
Showing posts with label IT. Show all posts

Client Issues A Request And Server Sends A Response

As seen earlier, each web server controls a website from amongst the collection of several web pages (i.e, the website), one page is treated as a "Default Web Development".

When a Browser connects to a Web Server using an appropriate protocol name, IP address and port number, and the Web Server treat this connection to be a request for the 'Default Web Document'. The Web Server then dispatches the 'Default Web Document' to the client who connected.

if the client requires viewing any other web pages then the client can specify the web page name (if known) along with the connection information. Thus the complete connection and web page information will now be specified as 


protocol://servername:port number/web page name.


A webpage, apart from the text and HTML tags, can also include references to external objects like GIF's, JPG's, Audio files, Video files and so on.

Thus the request for a webpage can be two-fold:


  • The webpage itself
  • The request for the object referenced by the web page i.e. GIF's, JPG's, Audio file, Video files, executable programs and so on. 
When an appropriately structured, HTTP request is received from a Browser, the web server will try ti locate the web page requested. If the web page exists, the server responds by providing the page to the browser,

if the webpage is not found, an appropriate 'Error Message' is sent as response to the browser request. After sending the web page the web server resets the connection with the browser.

After receiving the web page, the browser will identify the external objects that specified in the web page (if any) and request the server to deliver the external objects.

Such a request will result in a connection being re-established with the web server and a request being sent by the browser. The web server responds to the request being sent by browser.





Server Terminates The Connection

It is server's responsbility to terminate the TCP/IP connection with the browser after it responds to the browser's request, however both the browser and the web server must manager an unexpected closing of a connection as well. In other words, if the user clicks on the Browser's STOP button, the browser must close the connection.

Also a computer crash  by either a browser or a web serer must be recognized by the surviving computer, which in turn will close the connection.

Understanding How A Web Browser Communicates with A Web Server

As seen earlier, a web server is responsible for sending web pages to a browser on a client. When a Browser communicates with Web Server, it results into a four step HTTP transaction.
  
A client's browser retrieves a web page from the server and displays the webpage in the browser. The communication steps between the client and the server can be summarized as follows:


Before a client and server can exchange information they must first establish a connection. TCP/IP is used to let computers establish a link between a web server and web browser over the internet.

To communicate with web server, the client machine must given the IP address of the server along with the sub protocol that must used i.e. HTTP,FTP etc. 

The client browser will attempt to locate the server based on the IP address supplied and establish a connection.

A web server supports multiple protocols for example: a web server may support two protocols viz. In such cases each of the protocols (like HTTP, FTP) can be accessed by specifying protocol name and a specific "port number". 

Common protocols like HTTP, FTP etc have "well known" port numbers for example the HTTP protocol by default work on port number 80. 

Similarly the FTP protocol by default works on port number 21, If the protocols are configured on default port numbers, the connection to a Web Server can be established by:

        Protocol://IP adress

For example: if the IP address for the SCT server is 131.100.2.107 and communication must be established using HTTP then any client attempting to connect would have to pass the IP address as: http://131.100.2.107 to the ISP whose gateway is being used to access the internet

Protocols can be configured to run on port number other than the default port number valid values are 0 to 9999. If the protocols is configured to run on any other port number then the client when trying to establish a communication link with the web server must specify the port number along with the protocol name and the IP address.

Thus the complete syntax to access and connect to any server would be:
protocol://servername:port number.