Why Networked Java?

In the last 10 years, network coding has stopped being the province of a few specialists and become a core part of every developer's toolbox. Today, more programs are network aware than aren't. Besides classic apps like email, web browsers, and Telnet clients, most major apps have some level of networking built in. For example:

  • Text editors like BBEdit save and open files directly from FTP servers.
  • IDEs like Eclipse and IntelliJ IDEA communicate with CVS repositories.
  • Word processors like Microsoft Word open files from URLs.
  • Antivirus programs like Norton AntiVirus check for new virus definitions by connecting to the vendor's web site every time the computer is started.
  • Music players like Winamp and iTunes upload CD track lengths to CDDB and download the corresponding track titles.
  • Gamers playing Quake gleefully frag each other in real time.
  • Supermarket cash registers running IBM SurePOS ACE communicate with their store's server in real time with each transaction. The server uploads its daily receipts to the chain's central computers each night.
  • Schedule apps like Microsoft Outlook automatically synchronize calendars with other employees in the company.

In the future, the advent of web services and the semantic web is going to entwine the network ever more deeply in all kinds of apps. All of this will take place over the Internet and all of it can be written in Java. Java was the first programming language designed from the ground up with networking in mind. Java was originally designed for proprietary cable television networks rather than the Internet, but it's always had the network foremost in mind. One of the first two real Java apps was a web browser. As the global Internet continues to grow, Java is uniquely suited to build the next generation of network apps. Java provides solutions to a number of problems—platform independence and security being the most important—that are crucial to Internet apps, yet difficult to address in other languages. One of the biggest secrets about Java is that it makes writing network programs easy. In fact, it is far easier to write network programs in Java than in almost any other language. This tutorial shows you dozens of complete programs that take advantage of the Internet. Some are simple textbook examples, while others are completely functional apps. One thing you'll notice in the fully functional apps is just how little code is devoted to networking. Even in network intensive programs like web servers and clients, almost all the code handles data manipulation or the user interface. The part of the program that deals with the network is almost always the shortest and simplest. In brief, it is easy for Java apps to send and receive data across the Internet. It is also possible for applets to communicate across the Internet, though they are limited by security restrictions. In this chapter, you'll learn about a few of the network-centric apps that have been written in Java. In later chapters, you'll develop the tools you need to write your own network programs.