Guild Companies, Inc.  
 
Midrange Programmer - How-To Advice & Free Code
OS/400 Edition
Volume 1, Number 4 - February 28, 2002

How Does Your Browser Find a Web Page?

by Shannon O'Donnell

When you open a Web browser and type in a Web address, such as www.itjungle.com, somehow your computer must locate the computer where Guild Companies' Web pages reside. Then it must pull those Web pages back to your own computer and display them in your browser. But did you ever wonder how that works? Actually, it's pretty simple, and in this article you're going to learn how to set up your own PC so that it can find your iSeries. (For the purpose of the examples in this article, I'll assume you're using a home PC with a dial-up ISP, although the information here applies anywhere.)

Profound

Entering a Web Address in Your Browser

When you type the address www.midrangeserver.
com
into your browser, and press the Enter key (or click on Go or Submit or whatever), your browser sends a request, via TCP/IP, to your Internet service provider's server, asking it to locate the address you've just entered. Your ISP's server will then attempt to translate that address into an Internet Protocol address, such as 192.1.2.2. So, for the Web site to be found, the IP address of that site must be determined. That's probably the main reason your ISP attempts to translate the address you entered into a numeric, dotted IP address.

What Is DNS?

But how does your ISP know that 192.1.2.2 is the IP address for www.itjungle.com? It may not, but it does know how to find the address, because your ISP, just like all ISPs in the world, is part of the Domain Name System. An alphabetic Web address is stored, along with its IP address, in a table on a DNS server, where it can be looked up by an ISP.

DNS was developed by Sun Microsystems, in the early 1980s, as a convenient way to keep track of IP addresses. DNS is based on the concept of domains. A domain is a logical grouping of types of computers, such as .com or .gov. Each top-level, or primary, domain server, such as a DNS server acting as the top-level server for a .com domain, maintains a list of subordinate, or secondary, DNS servers. These secondary DNS servers also maintain a list of DNS servers that are subordinate to them, and which contain further information about the domain, such as the "midrangeserver" portion of www.itjungle.com. These lists contain dotted IP addresses for every human-readable portion of a Web address, which are used to identify each portion of that Web address. In this manner, any Web address can be located, because eventually every DNS server in the domain knows about every other DNS server, through the magic of propagation.

When the Web address you're searching for is finally found, that information is then propagated back to every DNS computer the request passed through on its way to its final destination. So if the dotted IP address for www.itjungle.com is 192.1.2.2, the information on the human-readable (or text- friendly) name and the dotted IP addresses will be stored in the DNS lookup table of every DNS server in that chain (at least in those servers which allow other DNS name resolvers to cache this type of information there!). In this manner, the next time you, or someone else on your local ISP, want to visit the www.itjungle.com Web site, the dotted IP address for that site will be immediately known, and your request will go through much faster.

While all that updating is going on, the information stored in TCP packets is being routed from the Web site your original request was finally sent to, back to your PC. There it is assembled into a meaningful package, HTML tags and text are loaded, links are resolved, and, finally, the Web site's information is displayed in your local browser.

PC Hosts Table

So that's DNS in a nutshell, and that's how Web pages are located and returned to your PC browser. I explained all that so you'd understand how the local PC Hosts table, which resides on your PC, works.

The PC Hosts table--stored in the C:\Winnt\System32\Drivers\Etc folder on most Windows 2000 PCs (although if you upgrade from Windows 98 to Windows 2000, you’ll find that file in the C:\Windows directory) or in the C:\Windows folder on a Windows 98/ME PC--is a file you can use to "manually" provide a text translation of dotted IP addresses.

The Hosts file on your local PC is much like the DNS lookup tables on DNS servers. In fact, it's used in pretty much the same manner. If you were to click on the Windows Start button, and then click on Run, you could type in the TCP/IP command ping, which would allow you to "ping" a Web address. PING is a simple command whose only purpose is to let one TCP/IP-connected computer verify that it can communicate with another TCP/IP-connected computer. For example, the following command would send out a request across the internet, according to the DNS scheme detailed above, to see if the remote server can be contacted by your local PC:

ping www.itjungle.com 

But what if you wanted to see if your local PC could talk to your local iSeries? If your iSeries IP address was 100.100.1.1, you could type in the following command:

Ping 100.100.1.1

Then, if you had a good TCP/IP connection to your iSeries, you'd get a message back telling you how many milliseconds the round-trip ping request took.

What if you wanted to refer to your iSeries by a more familiar text name? If your iSeries name was S100400, you couldn't normally replace the IP address 100.100.1.1, in the previous PING command, with S100400 and expect the worldwide DNS system to locate it. But you could, if your iSeries was part of a recognized domain on the Web, and if that name was also known to the worldwide DNS. For security reasons, however, we don't usually make our iSeries systems visible to the outside world, and therefore DNS servers usually don't know about them.

What would happen in the above example is that you'd get an error message telling you that the request timed out. So how can your local PC translate 100.100.1.1 into S100400? If you said, "By doing a lookup on the local Hosts table," you'd be correct! To create a relationship between a human-readable text name and the dotted IP address of your iSeries, you need to add an entry to the PC Hosts table.

You can edit the Hosts file by using the Notepad.exe text editor, which comes standard on all Windows PCs, or, if you're an old DOS geek like me, you can use the DOS edit command. Regardless of how you get in, once there you need to add an entry to the bottom of the Hosts file that looks like the following:

100.100.1.1	  S100400

The dotted IP address of your iSeries is 100.100.1.1, and your iSeries name is S100400. Or it can be any name you like; it does not have to be the same name as your iSeries system name. In fact, if you hated your job, you could have an entry like this:

100.100.1.1     TAKETHISJOBANDSHOVEIT

Or if you loved your job:

100.100.1.1      IAMABROWNNOSER

Once you've made the entry into the HOSTS table, save the file. Now you can enter a PING command, using the human-readable name you provided:

Ping TAKETHISJOBANDSHOVEIT

And you should get a positive response from the host (although, if your boss sees that entry, you may not get a positive response from him).

iSeries Host Table

The iSeries also contains a Host table, which is also used to identify the iSeries IP address and it’s more common name to the other TCP/IP services running on iSeries, such as WebSphere Application Server. You edit the iSeries Host table by entering the Configure TCP/IP Services (CFGTCP) command, from a 5250 command line, and then selecting option 10 – Work With TCP/IP Host Table Entries.

Interesting, but So What?

You're probably thinking that this information was somewhat interesting, but so what? Why should you care? One big reason to care is that, once you've defined an entry in your local PC's Hosts table, you can then use that entry, or it’s more common text name that you defined there, when you're configuring the WebSphere Development Studio Communications Console. Once you've configured that, you can refer to your iSeries in any of the WebSphere Development Studio tools by name, rather than by IP address. And any time you don't have to remember an IP address, especially when you're working with more than one iSeries system, is a good thing!

Until Next Time…

Cool, huh? You can play with the local Hosts file now, and try out some different IP name and address combinations, until you are comfortable with how all of this works. In the next issue, I'll show you where and how to put this information to work!

Shannon O'Donnell is co-editor of Midrange Programmer, OS/400 Edition, and director of advanced technologies at Jano Justice Systems. You can reach him at sodonnell@itjungle.com.

Sponsored By
PROFOUND LOGIC SOFTWARE

Looking to increase programmer productivity? Visit http://www.RPGAlive.com/now.

RPG-Alive adds an array of graphical features to IBM's native Source Edit Utility, and is one of only a few products to receive a 10 out of 10 rating in an independent evaluation by 400Times.

RPG-Alive allows RPG programmers to quickly gain an understanding of existing RPG programs, and facilitates a quicker way for programmers to change or write new source code.

Here is what RPG-Alive users say:

Name: Glenn Elliott
Company: GDX Automotive
"Your software is awesome. If someone were to sit down and figure out a great software program to accent code generation on a 400, this would be it. Everything from source code indentation to promptable key words. What a time saver! Thank you for saving me some time!"

Name: Stuart Rowe
Company: Help/Systems, Inc.
"Installation went flawlessly, it started working without asking any questions, no lengthy setup, keep it up you're doing a great job. I have my manager poised over the checkbook with pen in hand as I type this."

Name: Krish Thirumalai
Company: Manhattan Associates
"Excellent product. We have a lot of people in our organization that use and love this product. The built-in help for opcodes and BIF's is really cool! Our programmers no longer need to search for their RPG manuals to look up these opcodes."

Name: Jim Kucharik
Company: Victaulic Company of America
"Your product has won the hearts of our programmers, not an easy thing to do!"

To try RPG-Alive on your system, visit http://www.RPGAlive.com/now or call (937) 439-7925.

THIS ISSUE
SPONSORED BY:
Help/Systems
SoftLanding Systems
BCD Int'l
Jacada Ltd.
Profound Logic Software
WorksRight Software
BACK ISSUES
TABLE OF CONTENTS
The Basics of ILE Service Programs
Basic HTML: Headers, Bodies, and Flying Text
Getting Acquainted with Grep
JSP Server-Side Error Handling, Part 1
How Does Your Browser Find a Web Page?
Calling RPG Native Methods from Java
  Newsletters | Subscribe | Advertise | About Us | Contact | Search | Home  
  Last Updated: 2/13/02
Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.