2.1.1- How the Web Server and Browser Communicate
by NT Community Manager.
|
| << 2.1.0- How the Web Server Works | Chapter2 | 2.1.2- Going Deeper into HTTP >> |
How the Web Server and Browser Communicate
It probably won't surprise you to learn that, when we discussed the communication between web server and browser in Chapter 1 , we gave an over-simplified picture of what really happens. In particular, we side-stepped any explanation of the physical processes involved in the transfer of information across the Internet. In this section, we return to discuss that topic in more depth. We won't digress into a full-scale history of the Internet and the World Wide Web – it's covered in many other places. Instead, we'll look at the physical workings of the Internet and intranet networks.
Internet Protocols and Railway Systems
The Internet is a network of interconnected nodes, in the same way that the subway system of a large city is a network of interconnected railway stations. The subway system is designed to carry people from one place to another; by comparison, the Internet is designed to carry information from one place to another.
While a subway system is built on a basis of steel (and other materials), the Internet uses a suite of networking protocols (known as TCP/IP) to transfer information around the Internet. A networking protocol is simply a method of describing information packets so they can be sent down your telephone-, cable-, or T1-line from node to node, until it reaches its intended destination.
One advantage of the TCP/IP protocol is that it can reroute information very quickly if a particular node or route is broken or is just plain slow. The perfectly-designed railway system would work in much the same way – taking passengers efficiently by a different route whenever one of the stations or tracks was closed down for repair.
When the user tells the browser to go fetch a web page, the browser parcels up this instruction using a protocol called the Transmission Control Protocol (or TCP). TCP is a transport protocol, which provides a reliable transmission format for the instruction. It ensures that the entire message is correctly packaged up for transmission (and also that it is correctly unpacked and put back together after it reaches its destination).
Before the parcels of data are sent out across the network, they need to be addressed. So a second protocol called Hypertext Transfer Protocol (or HTTP) puts an address label on it. HTTP is the protocol used by the World Wide Web in the transfer of information from one machine to another – when you see a URL prefixed with http://, you know that the internet protocol being used is HTTP.
Internet protocols (such as HTTP and FTP) control addressing and delivery, while transport protocols (such as TCP) ensure that each message is broken down, transported and reassembled correctly.
So if the Internet is like a railway system, then a web page request is like a non-stop train journey from A to B. Here, TCP is like the seating system that breaks down a group of passengers and freight into different sections of the train; while HTTP or FTP is like the intended destination instruction that is given to the train driver before the train departs.
The message passed from the browser to the web server is known as an HTTP request. When the web server receives this request, it checks its stores to find the appropriate page. If the web server finds the page, it parcels up the HTML contained within (using TCP), addresses these parcels to the browser (using HTTP), and sends them back across the network. If the web server cannot find the requested page, it issues a page containing an error message (in this case, the dreaded Error 404: Page Not Found) – and it parcels up and dispatches that page to the browser. The message sent from the web server to the browser is known as the HTTP response.
Here's an illustration of the process as we understand it so far.
| << 2.1.0- How the Web Server Works | Chapter2 | 2.1.2- Going Deeper into HTTP >> |

RSS

