Java Network Programming, 3rd Edition


[ Table of Contents | Examples | Index | Corrections | Order ]

Java’s growth over the last 10 years has been nothing short of phenomenal. Given Java’s rapid rise to prominence and the even more spectacular growth of the Internet, it’s a little surprising that network programming in Java is still so mysterious to so many. It doesn't have to be. In fact, writing network programs in Java is quite simple, as this book will show. Readers with previous experience in network programming in a Unix, Windows, or Macintosh environment should be pleasantly surprised at how much easier it is to write equivalent programs in Java. The Java core API includes well-designed interfaces to most network features. Indeed, there is very little application layer network software you can write in C or C++ that you can’t write more easily in Java. Java Network Programming endeavors to show you how to take advantage Java’s network class library to quickly and easily write programs that accomplish many common networking tasks. Some of these include:

Java is the first language to provide such a powerful cross-platform network library, which handles all these diverse tasks. Java Network Programming exposes the power and sophistication of this library. This book’s goal is to enable you to start using Java as a platform for serious network programming. To do so, this book provides a general background in network fundamentals, as well as detailed discussions of Java’s facilities for writing network programs. You’ll learn how to write Java programs that share data across the Internet for games, collaboration, software updates, file transfer, and more. You’ll also get a behind-the-scenes look at HTTP, SMTP, TCP/IP, and the other protocols that support the Internet and the Web. When you finish this book, you’ll have the knowledge and the tools to create the next generation of software that takes full advantage of the Internet.


About the Third Edition

In 1996, in the first chapter of the first edition of this book, I wrote extensively about the sort of dynamic, distributed network applications I thought Java would make possible. One of the most exciting parts of writing subsequent editions has been seeing virtually all of the applications I postulated come to pass. Programmers are using Java to query database servers, monitor web pages, control telescopes, manage multiplayer games, and more, all by using Java’s native ability to access the Internet. Java in general and network programming in Java in particular has moved well beyond the hype stage and into the realm of real, working applications. Not all network software is yet written in Java, but it’s not for a lack of trying. Efforts are well under way to subvert the existing infrastructure of C-based network clients and servers with pure Java replacements. Clients for newer protocols like Gnutella and Freenet are preferentially written in Java. It’s unlikely that Java will replace C for all network programming in the near future. However, the mere fact that many people are willing to use web browsers, web servers, and more written in Java shows just how far we’ve come since 1996.

This book has come a long way, too. The third edition has one completely new chapter to describe the most significant development in network programming since readers and writers were introduced in Java 1.1. I refer of course to the new I/O APIs in the java.nio package. The ability to perform non-blocking I/O operations is critical for high-performance network applications, especially servers. It removes one of the last barriers to using Java for network servers. Many other chapters have been updated to take advantage of these new I/O APIs.

There've been lots of other small changes and updates throughout the java.net and supporting packages in Java 1.4 and 1.5, and these are covered here as well. New classes addressed in this edition include CookieHandler, SocketAddress, Proxy, NetworkInterface, and URI. IPv6 has become a reality, and is now covered extensively. Many other methods have been added to existing classes in the last two releases of Java, and these are discussed in the relevant chapters. I've also rewritten large parts of the book to reflect changing fashions in Java programming in general and network programming in particular. Applets and CGI programs are emphasized much less. In their place, you'll find more generic discussion of remote code execution and server-side environments, however implemented.

Of course, the text has been cleaned up, too. There's only one completely new chapter here, but the 18 existing chapters have been extensively rewritten and expanded to bring them up-to-date with new developments as well as to make them clearer and more engaging. I hope you’ll find this third edition an even stronger, longer-lived, more accurate, and more enjoyable tutorial and reference to network programming in Java than the last edition.

If I've succeeded in piquing your interest, you should be able to find Java Network Programming at almost any bookstore that carries computer books including the Amazon.com. It's also available on Safari. If you need to special order it, the ISBN number is 0-596-00721-3. It's $39.95, published by O'Reilly, and written by me, Elliotte Rusty Harold.


New chapters and sections in this edition are marked in red. In addition, much of the old content has been rewritten and updated.

Table of Contents

Preface
1. Why Networked Java?
2. Basic Network Concepts
3. Basic Web Concepts
4. Java I/O
5. Threads
6. Looking Up Internet Addresses
7. URLs and URIs
8. HTML in Swing
9. Sockets for Clients
10. Sockets for Servers
11. Secure Sockets
12. Non-Blocking I/O
13. UDP Datagrams and Sockets
14. Multicast Sockets
15. The URLConnection Class
16. Protocol Handlers
17. Content Handlers
18. Remote Method Invocation
19. The JavaMail API
Index

[ Cafe au Lait | Examples | Corrections | Index | Order ]

Copyright 2004 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified November 5, 2004