# How TTF & The Internet Work



## Beorn (Feb 17, 2004)

How TTF works
There are a lot of ways to describe how TTF works. The most basic description is, "Your computer requests information from TTF's computer. TTF's computer formats that information all nice and pretty, and sends it back"

Well, that really is all it does. When you go to your browser (lets assume in this article, if you will, it's Internet Explorer) and type 'http://www.thetolkienforum.com', a lot happens. First lets break up that URL. Oh, yeah. A URL is a Uniform Resource Locator. It’s a way of pointing to something on the internet (more on that idea later). The URL contains a lot of parts. First is http://. That tells your computer to work with the rest using the HTTP, AKA Hyper-Text Transfer Protocol. That doesn’t matter, except that it’s different from other protocols, such as FTP (File Transfer Protocol). Then, the URL says, contact the machine called WWW in the area called thetolkienforum.com. Your computer assumes you mean the bottommost directory, and adds a / on the end.

But, the internet doesn’t care whether it’s called snorkel.someplace.qas. That’s where DNS comes in. DNS stands for Domain Naming System. Your computer contacts your ISP’s (Internet Service Provider’s) DNS machine. Your computer asks, “What is the IP address for thetolkienforum.com’s DNS machine?” The DNS machine responds with an IP. An IP is a four part number. Each part is separated by a period. Each part is a number from 0 to 255. An example would be 1.2.3.4, or 65.92.4.214. The point is this: all computers on the internet, or on networks, have IP addresses. The IP address is like your mailing address. It tells where data (called ‘packets’) should go. Your computer then contacts the DNS machine for ‘thetolkienforum.com’, and asks, “What is the IP for www?” It responds with ‘209.126.174.240’.

Now, we know where www.thetolkienforum.com is. But, there isn’t a wire directly between your computer and TTF. There are millions of computers out there on the internet. Connecting each one would be impossible. So, your computer says to the one that it’s connected to, “Send this to 209.126.174.240.” That computer says to another, “Send this to 209.126.174.240, and tell it that it’s from Your IP”, where Your IP is your IP address. That says to another computer….You get the point. It takes somewhere around 15 of these “hops” to get from one computer to another on the internet.

Your computer sends this to TTF’s machine. This is an example of the HTTP Protocol:


> GET / HTTP/1.0
> Host: www.thetolkienforum.com


. That says, “Give me the output for /. I’m using HTTP version 1.0, and I’m trying to talk to www.thetolkienforum.com”. It’s important that your machine specifies the name of the computer it wants. A computer can have different names. For example, the computer named www.thetolkienforum.com is also named www.middle-earth-rpg.com. The server, as it is called because it serves everyone else, needs to know what your computer is looking for. The server says, “I know that / should be considered a file called index.php” because of how the server is configured.

Now, you can stop here, and go on your merry way. The above was a simplified version of the internet…but if you want to understand how TTF works, carry on.

So, the server says, “OK, I’ll take a look and see what’s in index.php.” The ‘.php’ on the end is important. It says that there will probably be code in a language called PHP in the file. Lo and behold, there is. The code gives instructions on how to dig up and format the information that will be returned to your computer. The code says first to connect to a database. A database is a giant store of information. All of TTF’s posts, threads, announcements, members, PMs, etc, are in a database. Once the code has connected to the database, it requests information with what are known as queries. One query may be:


> SELECT forumid, title FROM forum


. This asks the database, “Give me all the forum ids and their corresponding titles from the table named forum.” A table is, well, a table. Each row is one data entry. One row in the user table is a member. One row in the post table is a post. Each row has different fields. A row in the user table may have userid, username, e-mail address, AIM, MSN, ICQ, Yahoo, and all your preferences. The database responds, the forum takes all the information, and puts it into templates.

The templates are why TTF looks so neat. It’s all repetition. A post always looks the same as the one before it because only the words in a post are saved, not the whole look of it.

So, once the stuff is in templates, the server sends it all back to your IP. Your computer gets HTML back. The HTML is Hyper-Text Markup Language. Basically, it tells your computer how to structure text. The text is structured, and put in place, and you see it.

So, I’ll be taking questions now….


----------



## Aerin (Feb 18, 2004)

After reading all that, I just have one question: What does the "post a reply" button do?






I just had to!


----------



## Firawyn (Feb 4, 2005)

When I did a search on "Sabeen" it brought up the link to my profile here. Why did it bring up that but not links to all the posts I've made?


----------



## Barliman Butterbur (Feb 4, 2005)

Beorn said:


> ...So, I’ll be taking questions now….



Well, after reading all of that (and getting into a state of mental paralysis) I can only say that I am more grateful than ever to wizards like Beorn who _understand_ and make use of all these subtleties so that the rest of us can enjoy ourselves with a few clicks of the mouse!

But I do have a question: how was the TTF browser planned out and executed? It's one of the most sophisticated ones I've experienced. The lines of code alone must be humongous...

Barley


----------



## Jesse (Feb 6, 2005)

Ummm...I don't know what to say to this thread...


----------

