Foundations of Python 3 Network Programming, Second Edition
Tags
Summary
This book is the second edition of Foundations of Python Network Programming, co-authored by Brandon Rhodes and John Goerzen and published by Apress in 2010. As the user's title indicates, this book corresponds to the Python 3 edition of the network programming text: throughout, it uses Python 3 example code to explain how to build network clients, servers, and network tools. Starting from the socket interface provided by the operating system, it gradually covers TCP and UDP communication, hostname and DNS resolution, HTTP client-server interaction, sending and receiving and encoding email protocols, file transfer such as FTP, remote procedure calls and web services, SSL/TLS encrypted communication, and concurrency in server architecture (multiprocessing, multithreading, asynchronous I/O, and related topics). The first edition was written solely by John Goerzen; the second edition was rewritten with Brandon Rhodes, migrating examples and library usage to Python 3 and adding then-current network application practices. The authors' starting point is "understanding networks from the application developer's perspective": rather than listing protocol specifications, the book explains why each protocol is used the way it is in real programs, where common pitfalls lie, and how Python's standard library and third-party libraries can be combined. Most code snippets can be run and adapted directly, making the book a practical reference alongside the documentation. Note: the Chinese edition circulating online under the same title, Python Network Programming (3rd Edition) (People's Posts and Telecommunications Press, translated by Zhu Haowen), corresponds to the third edition of this book, not the second edition described here; please be mindful of edition differences when purchasing or comparing.
Editor's review
这是一本写给“会写 Python、但对网络心里没底”的开发者的书。它的价值不在于把 TCP/IP 讲成教材,而在于把协议知识落到可运行的代码上:一个 socket 连接从建立到关闭经历了什么,DNS 解析失败该怎么看,HTTP 请求头为什么这样写,邮件正文的编码为什么总出乱码。作者 Brandon Rhodes 长期活跃于 Python 社区,讲解风格偏务实,愿意指出标准库的边界和第三方库的取舍。第二版的意义在于示例整体迁到 Python 3,对那些仍在用 Python 2 时代资料学习的人尤其有用。阅读建议是配合自己的实验环境动手:书中的例子不长,改一改参数、抓一次包,收获会远大于通读。需要提醒的是,本书成书于 2010 年,部分库与框架(如某些服务器框架、旧式并发写法)已显陈旧,遇到与现状不符的地方,应把它当作“理解原理的入口”,再结合官方文档核实细节。
Who it's for
A good fit for
- 已掌握 Python 基础语法,想系统理解网络编程的开发者
- 需要写爬虫、API 客户端或小型网络服务的工程师
- 习惯通过示例代码学习协议细节的自学者
- 读过第一版、想找 Python 3 示例版本的读者
Not a good fit for
- 完全没有 Python 基础、需要先学语法的初学者
- 希望系统学习计算机网络理论、协议数学推导的读者
- 只想要最新框架实战、不愿读偏旧内容的人
Reading tips
- 先跑通前几章的 socket 示例,用 Wireshark 抓包对照,理解连接建立与数据收发过程。
- 读 HTTP 与邮件章节时,边读边用标准库写小工具,比单纯记忆协议字段更有效。
- 遇到书中过时的库或写法,先理解其解决的问题,再查对应现代替代方案。
- 把本书当参考手册而非小说,按项目需要跳读相应章节,并保留代码笔记。
FAQ
这本书和中文版《Python网络编程(第3版)》是同一本吗?
不是同一版次。中文版《Python网络编程(第3版)》(人民邮电出版社,诸豪文译)对应的是本书的第三版;本条目是 2010 年出版的第二版,内容与示例的组织有所不同,阅读和引用时需注意区分版次。
第二版与第一版的主要区别是什么?
第一版由 John Goerzen 独著,第二版由 Brandon Rhodes 与 John Goerzen 合作改写,示例与库用法整体向 Python 3 迁移,并更新了部分网络应用实践的讲解,因此第二版被普遍视为面向 Python 3 的版本。
书中的代码现在还能直接运行吗?
核心的 socket、HTTP、邮件、DNS 等标准库示例思路仍然适用,但由于成书于 2010 年,涉及的第三方库、服务器框架和部分并发写法可能已更新或弃用,建议以官方文档为准做适配。
阅读前需要先学计算机网络课程吗?
不必。本书从客户端/服务器模型和套接字讲起,对协议背景有必要的铺垫;但如果你同时具备 TCP/IP 基本概念,阅读会顺畅很多,也能更好理解书中的取舍。
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.