How the Internet Works


Before .NET, developing applications for "the Web" was cumbersome and boring. And with good reason: The World Wide Web was not designed as a programming or logic-processing platform. It was originally all about sending specially formatted text files from one computer to another. No programming languages to learn. No custom logic. Just plain text, and maybe a binary graphic image or two.

Early web browsers were really just glorified file-copy programs. When you started up the Mosaic browser (pretty much all there was back then) and requested a Web page from another computer, here is what would happen.

  • The web browser determines the IP address of the remote system.

  • The web browser contacts the remote system via TCP/IP port number 80.

  • The remote system accepts the connection.

  • The web browser says, "Hey, I'm looking for a file named index.html. Could you send it to me?"

  • The remote system says, "I have it," and immediately sends it.

  • The remote system closes the connection.

Much of this process is hidden from view, but you can actually see it happen. If you're interested, open the Windows command prompt, and type the following command.

telnet www.google.com 80 


This runs the telnet program, a terminal emulation program that lets you connect to remote systems through a text interface. Telnet usually connects to TCP/IP port 23, but you can specify any port you want, as we did here with the default WWW port of 80.

Your screen may go blank, or it may just sit there, looking dead. If you're lucky, you'll see a "connected" message, but perhaps not. And that's okay. Your system is connected to Google's web server. Type the following command.

GET / HTTP/1.0 


Don't miss the spaces surrounded the first slash. Follow this command with two light taps on the Enter key. This command asks the remote system to send the default web page at the top of that server's Web hierarchy. And because you asked, it will.

[View full width]

HTTP/1.0 200 OK Cache-Control: private Content-Type: text/html Set-Cookie: PREF=ID=f2a86cd6479fb5ec:TM=1147737754: LM=1147737754:S=Wpw0SS-C3B-eTJJu; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com Server: GWS/2.1 Date: Tue, 16 May 2006 00:02:34 GMT Connection: Close <html><head> ...rest of HTML web page content here... </body></html> Connection to host lost.


Of course, you do not normally see all this. The web browser carries on this dialog for you, and nicely formats the response as a web page. This is actually all there is to the World Wide Web. You have just experienced the major features involved: the transfer of basic data through a TCP/IP port. So where does programming come in?




Start-to-Finish Visual Basic 2005. Learn Visual Basic 2005 as You Design and Develop a Complete Application
Start-to-Finish Visual Basic 2005: Learn Visual Basic 2005 as You Design and Develop a Complete Application
ISBN: 0321398009
EAN: 2147483647
Year: 2006
Pages: 247
Authors: Tim Patrick

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