Java Network Programming (Third Edition)
Tags
Summary
This book is the Chinese translation of the third edition of O'Reilly's classic Java technical book Java Network Programming, aimed at developers who need to write network programs in Java. It begins with network fundamentals, first laying out layered models, IP/TCP/UDP, the client-server model, and internet standards, then moves into practical explanation of the Java networking APIs: stream wrapping and reading/writing, multithreading and thread pools, address resolution with InetAddress and NetworkInterface, URL and URI handling and proxy settings, extending to displaying HTML in Swing components and cookie management. The core sections cover client sockets and server-side ServerSocket, as well as secure socket programming provided by JSSE; it then explains the Buffer, Channel, and selector model in NIO for building high-performance non-blocking servers, and also covers UDP datagrams and DatagramChannel, multicast sockets, URLConnection and HttpURLConnection, content handlers and protocol handlers, RMI remote method invocation, and the JavaMail API for sending and receiving mail, attachments, and MIME message handling. The third edition has been fully revised for network-related changes in JDK 1.4 and 1.5 (J2SE 5), and the book provides many complete client and server example programs that can be run directly.
Editor's review
在 Java 网络编程这个领域,O'Reilly 的这本书多年来一直被视为难以绕开的参考书。第三版的价值在于两点:一是覆盖面完整,从最基础的网络概念一直讲到 RMI 和 JavaMail,读者不必在几本书之间来回切换;二是重实践,作者没有停在 API 签名解释上,而是给出功能完整的客户端与服务器代码,读者可以边读边运行,并在此基础上改造成自己的程序。本版针对 JDK 1.4 与 1.5 的网络相关更新做了全面修订,NIO 部分尤其值得注意,它解释了如何用 Buffer、Channel 和选择器写出高并发的非阻塞服务器,这是理解后续 Java 网络框架的重要基础。朱涛江、林剑的译文术语统一、行文清楚,适合作为案头工具书长期翻阅。需要提醒的是,书中 API 以 J2SE 5 为基准,部分写法在今天已不是主流做法,但网络编程的模型、套接字语义与协议理解并不过时,作为底层原理教材仍然可靠。
Who it's for
A good fit for
- 有 Java 语法基础、想系统学习网络编程的开发者
- 需要查阅 java.net 包 API 用法与示例的在职程序员
- 准备面试或考试、需要补足 Socket 与 NIO 原理的求职者
- 想理解 HTTP、TCP/UDP 底层行为的高校学生与教师
Not a good fit for
- 完全没有 Java 基础、也不了解面向对象的零基础读者
- 只想学 Spring Boot 等现代框架快速开发业务的人
- 期望获得最新 Java 版本(如 17/21)示例代码的读者
Reading tips
- 先读第 1—3 章打牢网络与 Web 概念基础,再去啃 Socket 章节。
- 边读边敲示例代码,每学一个 API 就写一个最小的客户端或服务器程序。
- NIO 与组播、RMI 章节可先略读,遇到实际需求时再回头精读。
- 遇到 JDK 版本差异时,对照当前官方文档修正示例中的过时写法。
Contents
- Preface
- Chapter 1 Why Java Network Programming
- Chapter 2 Basic Network Concepts
- Chapter 3 Basic Web Concepts
- Chapter 4 Streams
- Chapter 5 Threads
- Chapter 6 Looking Up Internet Addresses
- Chapter 7 URLs and URIs
- Chapter 8 Displaying HTML with Swing
- Chapter 9 Sockets for Clients
- Chapter 10 Sockets for Servers
- Chapter 11 Secure Sockets
- Chapter 12 Nonblocking I/O
- Chapter 13 UDP Datagrams and Sockets
- Chapter 14 Multicast Sockets
- Chapter 15 URLConnection
- Chapter 16 Protocol Handlers
- Chapter 17 Content Handlers
- Chapter 18 Remote Method Invocation
- Chapter 19 The JavaMail API
- Index
FAQ
这本书的第三版对应哪个 Java 版本?
第三版针对 JDK 1.4 与 1.5(即 J2SE 5)的网络相关改动做了全面修订,示例以这一时期的 API 为准,部分写法在较新 JDK 中已不推荐,但网络模型与原理仍有参考价值。
中文版的译者和出版社是哪个?
中文版由朱涛江、林剑翻译,中国电力出版社 2005 年 11 月出版,属于 O'Reilly Java 系列,全书 718 页,ISBN 为 9787508338408。
书中的示例代码可以实际运行吗?
可以。作者提供了大量功能完整的网络客户端与服务器示例,原书说明这些代码可在线获取,读者只需按当前 JDK 版本做少量调整即可运行调试。
零基础读者可以直接读这本书吗?
不太合适。书中默认读者已掌握 Java 语法与面向对象基础,建议先完成 Java 入门学习,再读本书的网络部分,否则在流、线程与套接字章节容易卡住。
Comments
Find this book
This site is an index: you start “Search all sources” in your browser, and the entries it lists all point to third-party sites; please judge their availability yourself.