A Simplified View of a Computer Network


Actual implementations of networks can be complex and I'm not a networking expert, but here's a highly simplified overview. The Internet is a network of networks. Each network is identified by a domain name. A network (or a domain) is composed of a number of hosts, which are the individual computers on the network (sort of). Any given host may have one or more networked applications runningthings such as web servers and mail servers and so on. For multiple applications to work together without talking over each other, each networked application is assigned a port, which is just a number (an integer), and that application is said to listen to that port. When a request comes in, it is directed at a certain port so that the right server application will respond to the request. In addition, each individual computer has a file system on which it stores files. All these piecesthe domain, the host, the port, and the pathcan be used to identify individual resources on the network. To see how they are used together, I'll take a close look at how the World Wide Web works and step through the process that is required for you to request a page, receive it, and view it in your browser.

The Hypertext Transfer Protocol

The Hypertext Transfer Protocol (HTTP) is the protocol that makes the World Wide Web possible, but it isn't the only protocol that is needed. It also relies on the Transmission Control Protocol (TCP) and the Internet Protocol (IP), all of which I will discuss momentarily. In practical terms, HTTP is a simple protocol, and the way it works is this: There is a client (your web browser, usually) and a server (a web server of some sort) and the client sends a request to the server in the form of a header, which is a string of text that includes the information the server will need to respond appropriately. The server receives the header, processes it, and sends data back to the client.

You've no doubt used a web browser before, so you know that the way you use the browser is that you type the address into the address field and press Enter. After a few moments, a new html page is displayed in the browser. The address is known as a Uniform Resource Locator (URL), and this is used by the software to find a particular resourceusually an html file on a server somewhere.

URLs, Domain Names, and Hosts

A URL consists of a domain name, a hostname, a port number, and a path. This should be familiar to you now because in my simplified explanation of a network, I explained that a domain, a host, a port, and a path were all that were needed to find a given resource on the Internet. A URL is one way to represent those values.

When you are working on your own computer, it has a default hostname, localhost (you don't need a domain name because the request is local to your computer).

In some situations, one or more of these elements may be missing in the URL, and that's usually because of some default value. For instance, the default port is port 80, so you often see URLs without a port listed. You can also set up your network so that the hostname isn't necessary by routing all HTTP requests to a particular computer. Likewise, if you are running a web browser locally, you can refer solely to the host, without the domain, and successfully make the request (by default, the host is called localhost). You don't even need to have a complete path to a file because, by default, if the path points to a directory, it is assumed that you mean the file index.html within that directory.

A URL is supposed to be a unique reference to a resource. Usually that resource is a file of some sort, but it doesn't have to be. Many pages on websites are created dynamically when the request is made, so there really isn't an actual page somewherethe html is generated on-the-fly and sent back to the browser.

Ports

At the host, a web server is running, listening by default on port 80. It doesn't have to listen on port 80. It can listen on port 8080 if it wants to, and if that's the case, you need to specify the port in the URL, like so:

http://localhost:8080/


IP Addresses

There is one other element to add to the mix that I haven't mentioned yet, and that is IP addresses. Domain names and hosts use strings because human beings find it easier to work with and remember them, but computers always work better with numbers. That's why the real address of a computer is a numeric IP address, and that address is mapped to the domain name. Domain name servers (DNS) provide a way of mapping domain names to IP addresses so that behind the scenes, when you type in a domain name, the software looks up the IP address using DNS and then uses the IP address to locate the computer. You can easily exchange the actual IP address for the domain name in your browser and it will work just as well.

In any event, after the domain is found, followed by the host being found, an HTTP request is sent to the web server that is running on that host. There are three kinds of requests that every web server must accommodate: GET, PUT, and HEADERS. The path portion of the URL is then sent to the web server and the web server decides what to do with that path. In most cases, it uses the path to find an actual file on the file system, which it sends back out to the client.




REALbasic Cross-Platform Application Development
REALbasic Cross-Platform Application Development
ISBN: 0672328135
EAN: 2147483647
Year: 2004
Pages: 149

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net