Synopses & Reviews
This practical guide provides a complete introduction to developing network programs with Java. Youll learn how to use Javas network class library to quickly and easily accomplish common networking tasks such as writing multithreaded servers, encrypting communications, broadcasting to the local network, and posting data to server-side programs.
Author Elliotte Rusty Harold provides complete working programs to illustrate the methods and classes he describes. This thoroughly revised fourth edition covers REST, SPDY, asynchronous I/O, and many other recent technologies.
- Explore protocols that underlie the Internet, such as TCP/IP and UDP/IP
- Learn how Javas core I/O API handles network input and output
- Discover how the InetAddress class helps Java programs interact with DNS
- Locate, identify, and download network resources with Javas URI and URL classes
- Dive deep into the HTTP protocol, including REST, HTTP headers, and cookies
- Write servers and network clients, using Javas low-level socket classes
- Manage many connections at the same time with the nonblocking I/O
The style of both Java and network programming have slowly changed over the past seven years, and the new edition of this popular book reflects that. Java Network Programming, Fourth Edition is a complete introduction to developing network programs using Java, with new coverage of REST, SPDY, and Jar URLs, among others. The author also includes APIs that have appeared up to Java 7.
About the Author
Elliotte Rusty Harold is originally from New Orleans to which he returns periodically in search of a decent bowl of gumbo. However, he currently resides in the Prospect Heights neighborhood of Brooklyn with his wife Beth and dog Thor. He's a frequent speaker at industry conferences including Software Development, Dr. Dobb's Architecture & Design World, SD Best Practices, Extreme Markup Languages, and too many user groups to count. His open source projects include the XOM Library for processing XML with Java and the Amateur media player.
Table of Contents
Dedication; Preface; About the Fourth Edition; Organization of the Book; Who You Are; Java Versions; About the Examples; Conventions Used in This Book; Request for Comments; Using Code Examples; Safari® Books Online; How to Contact Us; Acknowledgments; Chapter 1: Basic Network Concepts; 1.1 Networks; 1.2 The Layers of a Network; 1.3 IP, TCP, and UDP; 1.4 The Internet; 1.5 The Client/Server Model; 1.6 Internet Standards; Chapter 2: Streams; 2.1 Output Streams; 2.2 Input Streams; 2.3 Filter Streams; 2.4 Readers and Writers; Chapter 3: Threads; 3.1 Running Threads; 3.2 Returning Information from a Thread; 3.3 Synchronization; 3.4 Deadlock; 3.5 Thread Scheduling; 3.6 Thread Pools and Executors; Chapter 4: Internet Addresses; 4.1 The InetAddress Class; 4.2 Inet4Address and Inet6Address; 4.3 The NetworkInterface Class; 4.4 Some Useful Programs; Chapter 5: URLs and URIs; 5.1 URIs; 5.2 The URL Class; 5.3 The URI Class; 5.4 x-www-form-urlencoded; 5.5 Proxies; 5.6 Communicating with Server-Side Programs Through GET; 5.7 Accessing Password-Protected Sites; Chapter 6: HTTP; 6.1 The Protocol; 6.2 HTTP Methods; 6.3 The Request Body; 6.4 Cookies; Chapter 7: URLConnections; 7.1 Opening URLConnections; 7.2 Reading Data from a Server; 7.3 Reading the Header; 7.4 Caches; 7.5 Configuring the Connection; 7.6 Configuring the Client Request HTTP Header; 7.7 Writing Data to a Server; 7.8 Security Considerations for URLConnections; 7.9 Guessing MIME Media Types; 7.10 HttpURLConnection; Chapter 8: Sockets for Clients; 8.1 Using Sockets; 8.2 Constructing and Connecting Sockets; 8.3 Getting Information About a Socket; 8.4 Setting Socket Options; 8.5 Socket Exceptions; 8.6 Sockets in GUI Applications; Chapter 9: Sockets for Servers; 9.1 Using ServerSockets; 9.2 Logging; 9.3 Constructing Server Sockets; 9.4 Getting Information About a Server Socket; 9.5 Socket Options; 9.6 HTTP Servers; Chapter 10: Secure Sockets; 10.1 Secure Communications; 10.2 Creating Secure Client Sockets; 10.3 Choosing the Cipher Suites; 10.4 Event Handlers; 10.5 Session Management; 10.6 Client Mode; 10.7 Creating Secure Server Sockets; 10.8 Configuring SSLServerSockets; Chapter 11: Nonblocking I/O; 11.1 An Example Client; 11.2 An Example Server; 11.3 Buffers; 11.4 Channels; 11.5 Readiness Selection; Chapter 12: UDP; 12.1 The UDP Protocol; 12.2 UDP Clients; 12.3 UDP Servers; 12.4 The DatagramPacket Class; 12.5 The DatagramSocket Class; 12.6 Socket Options; 12.7 Some Useful Applications; 12.8 DatagramChannel; Chapter 13: IP Multicast; 13.1 Multicasting; 13.2 Working with Multicast Sockets; 13.3 Two Simple Examples; Index; Colophon;