New to Java? We'll help you get started with our revised beginner's tutorial, or our free online textbook.


Get the latest Java books
h t t p : / /w w w . j a v a c o f f e e b r e a k . c o m /

Java Coffee Break

Section 1.7
The Internet and the World-Wide Web


COMPUTERS CAN BE CONNECTED together on networks. A computer on a network can communicate with other computers on the same network by exchanging data and files or by sending and receiving messages. Computers on a network can even work together on a large computation.

Today, millions of computers throughout the world are connected to a single huge network called the Internet. New computers are being connected to the Internet every day. In fact, a computer can join the Internet temporarily by using a modem to establish a connection through telephone lines.

There are elaborate protocols for communication over the Internet. A protocol is simply a detailed specification of how communication is to proceed. For two computers to communicate at all, they must both be using the same protocols. The most basic protocols on the Internet are the Internet Protocol (IP), which specifies how data is to be physically transmitted from one computer to another, and the Transmission Control Protocol (TCP), which ensures that data sent using IP is received in its entirety and without error. These two protocols, which are referred to collectively as TCP/IP, provide a foundation for communication. Other protocols use TCP/IP to send specific types of information such as files and electronic mail.

All communication over the Internet is in the form of packets. A packet consists of some data being sent from one computer to another, along with addressing information that indicates where on the Internet that data is supposed to go. Think of a packet as an envelope with an address on the outside and a message on the inside. (The message is the data.) The packet also includes a "return address," that is, the address of the sender. A packet can hold only a limited amount of data; longer messages must be divided among several packets, which are then sent individually over the net and reassembled at their destination.

Every computer on the Internet has an IP address, a number that identifies it uniquely among all the computers on the net. The IP address is used for addressing packets. A computer can only send data to another computer on the Internet if it knows that computer's IP address. Since people prefer to use names rather than numbers, many computers are also identified by names, called domain names. For example, the main computer at Hobart and William Smith Colleges has the domain name hws3.hws.edu. (Domain names are just for convenience; your computer still needs to know IP addresses before it can communicate. There are computers on the Internet whose job it is to translate domain names to IP addresses. When you use a domain name, your computer sends a message to a domain name server to find out the corresponding IP address. Then, your computer uses the IP address, rather than the domain name, to communicate with the other computer.)


The Internet provides a number of services to the computers connected to it (and, of course, to the users of those computers). These services use TCP/IP to send various types of data over the net. Among the most popular services are Telnet, electronic mail, FTP, and the World-Wide Web.

Telnet allows a person using one computer to log on to another computer. (Of course, that person needs to know a user name and password for an account on the other computer.) Telnet provides only a command-line interface. Essentially, the first computer acts as a terminal for the second. Telnet is often used by people who are away from home to access their computer accounts back home -- and they can do so from any computer on the Internet, anywhere in the world.

Electronic mail, or email, provides person-to-person communication over the Internet. An email message is sent by a particular user of one computer to a particular user of another computer. Each person is identified by a unique email address, which consists of the domain name of the computer where they receive their mail together with their user name or personal name. The email address has the form "username@domain.name". For example, my own email address is: eck@hws.edu. Email is actually transferred from one computer to another using a protocol called SMTP (Simple Mail Transfer Protocol). Email might still be the most common and important use of the Internet, although it has certainly been challenged in popularity by the World-Wide Web.

FTP (File Transport Protocol) is designed to copy files from one computer to another. As with Telnet, an FTP user needs a user name and password to get access to a computer. However, many computers have been set up with special accounts that can be accessed through FTP with the user name "anonymous" and any password. This so-called anonymous FTP can be used to make files on one computer publically available to anyone with Internet access.

The World-Wide Web (WWW) is based on pages which can contain information of many different kinds as well as links to other pages. These pages are viewed with a Web browser program such as Netscape or Internet Explorer. Many people seem to think that the World-Wide Web is the Internet, but it's really just a graphical user interface to the Internet. The pages that you view with a Web browser are just files that are stored on computers connected to the Internet. When you tell your Web browser to load a page, it contacts the computer on which the page is stored and transfers it to your computer using a protocol known as HTTP (HyperText Transfer Protocol). Any computer on the Internet can publish pages on the World-Wide Web. When you use a Web browser, you have access to a huge sea of interlinked information that can be navigated with no special computer expertise. The Web is the most exciting part of the Internet and is driving the Internet to a truly phenomenal rate of growth. If it fulfills its promise, the Web might become a universal and fundamental part of everyday life.

I should note that a typical Web browser can use other protocols besides HTTP. For example, it can also use FTP to transfer files. The traditional user interface for FTP was a command-line interface, so among all the other things it does, a Web browser provides a modern graphical user interface for FTP. (This fact should help you understand that FTP is not a program. It is a set of standards for a certain type of communication between computers. To use FTP, you need a program that implements those standards. Different FTP programs can present you with very different user interfaces. Similarly, different Web browser programs can present very different interfaces to the user, but they must all use HTTP to get information from the Web.)


Now just what, you might be thinking, does all this have to do with Java? In fact, Java is intimately associated with the Internet and the World-Wide Web. As you have seen in the previous section, special Java programs called applets are meant to be transmitted over the Internet and displayed on Web pages. A Web server transmits a Java applet just as it would transmit any other type of information. A Web browser that understands Java -- that is, that includes an interpreter for the Java virtual machine -- can then run the applet right on the Web page. Since applets are programs, they can do almost anything, including complex interaction with the user. With Java, a Web page becomes more than just a passive display of information. It becomes anything that programmers can imagine and implement.

Its association with the Web is not Java's only advantage. But many good programming languages have been invented only to be soon forgotten. Java has had the good luck to ride on the coattails of the Web's immense and increasing popularity.



End of Chapter 1

[ Next Chapter | Previous Section | Chapter Index | Main Index ]