Foundations of Python Network Programming, Third Edition cover

Foundations of Python Network Programming, Third Edition

Rating 4.6
Word count
532 words
Chapters
17
Series
Turing Program Design Series
ISBN
9787115433503

Tags

Summary

This is the Chinese translation of the third edition of Foundations of Python Network Programming. All examples are written in Python 3. The book is aimed at developers who already have some Python background and want to understand network protocols in depth and build network applications with Python. It begins with the client/server model, first laying out the layered relationship between protocol stacks and libraries, the use of application-layer protocols, character encoding and decoding, IP addresses and routing, then moves on to UDP and TCP socket programming, covering practical details such as port numbers, binding to interfaces, timeouts and backoff, connection management, deadlock and half-open connections. It then covers socket names and DNS resolution, serialization of network data and handling of network errors, and TLS/SSL encrypted communication. On the server side, the book discusses multiprocess/multithreaded server architectures and the use of caching and message queues, and analyzes HTTP from both client and server perspectives, extending to security topics in web applications, including the principles and defenses of cross-site scripting (XSS) and cross-site request forgery (CSRF). The second half turns to classic Internet application protocols: composing and parsing email, sending with SMTP, retrieving with POP and IMAP, remote login with Telnet and SSH, and RPC. The book includes numerous runnable code listings and examples, and touches on practical topics such as configuring URLs in the Flask framework and writing asynchronous I/O event loops, helping readers turn protocol principles into working code.

Editor's review

市面上的 Python 网络书大体分两类:一类只讲 requests、scrapy 这类库怎么调用,一类上来就讲 TCP 三次握手、滑动窗口,读完却不知道在 Python 里怎么写。这本书难得地站在中间——从应用开发者的视角出发,把「协议为什么这样设计」和「Python 里怎么写出来」并排放。 它采用 Python 3 示例,涵盖 UDP、TCP 套接字、DNS、TLS/SSL、服务器架构、HTTP 客户端与服务器、电子邮件三大协议(SMTP/POP/IMAP)、SSH 与 RPC,几乎把网络编程的经典话题一网打尽,而且每章都给出可运行代码清单,不是伪代码。 尤其值得称道的是对现代话题的处理:Python 3 的 SSL 支持、异步 I/O 事件循环的编写方法、用 Flask 配置 URL,以及 XSS、CSRF 的攻击原理与防护,都写在了书里 — 这些内容让一本 2016 年的书至今读起来仍不过时。作者 Brandon Rhodes 是 Dropbox 工程师、长期活跃于 PyCon 的知名讲者,行文很清楚,讲原理不绕弯。豆瓣读者给出 9.2 分,对一本技术书来说是很实在的口碑。适合想从「会调库」走向「懂网络」的 Python 开发者放在手边翻阅。

Who it's for

A good fit for

  • 已掌握 Python 基础语法、想系统补齐网络编程知识的中级开发者
  • 需要自行编写服务端、爬虫或中间件,要理解 TCP/UDP 细节的后端工程师
  • 做运维、系统集成,需要处理 DNS、邮件协议、SSH、RPC 的技术人员
  • 计算机专业学生,用来把「计算机网络」课程理论与可运行代码对齐

Not a good fit for

  • 完全零编程经验、连函数与类都不熟悉的初学者
  • 只想找现成框架、不想了解底层协议原理的读者
  • 寻找 Python 3.10 以后新语法与新库(如 asyncio 最新 API)的读者

Reading tips

  1. 对照阅读第1、2、3章,先手写一遍原始 UDP/TCP 客户端与服务端,再回头理解协议分层。
  2. 把书中代码真正跑起来:用 tcpdump 或 Wireshark 抓包对照,理解每个字节在网络上如何传输。
  3. 按「HTTP 客户端→服务器→万维网安全」顺序读第9至11章,再配合 Flask 实践做一个小型 Web 服务。
  4. 邮件、SSH、RPC 等协议章节可按工作需求跳读,当作协议速查手册随时回翻。

About the publisher

Posts & Telecom Press China · Founded in 1953

Posts & Telecom Press is known for its strengths in science and technology, computing, and information and communications titles, and has extended its publishing into photography, art, software learning, and inspirational growth, giving it a fairly diverse range. Its catalog includes computing and communications works such as Refactoring and Patterns (Revised Edition) and Huawei Switch Learning Guide (Second Edition), alongside bilingual collector's editions such as The Little Prince (Chinese-English-French illustrated collector's edition), The Great Gatsby, and Three Days to See. Beijing Ten Years: 1980-1990 and Ghost Blade: WLOP Personal Illustration Collection reflect its presence in photography and art. Its authors include Antoine de Saint-Exupéry, Helen Keller, Joshua Kerievsky, Wang Da, Zhang Zhaozeng, and WLOP.

Contents

  1. Chapter 1 Introduction to Client/Server Networking
  2. Chapter 2 UDP
  3. Chapter 3 TCP
  4. Chapter 4 Socket Names and DNS
  5. Chapter 5 Network Data and Network Errors
  6. Chapter 6 TLS/SSL
  7. Chapter 7 Server Architecture
  8. Chapter 8 Caching and Message Queues
  9. Chapter 9 HTTP Clients
  10. Chapter 10 HTTP Servers
  11. Chapter 11 The World Wide Web
  12. Chapter 12 Composing and Parsing Email
  13. Chapter 13 SMTP
  14. Chapter 14 POP
  15. Chapter 15 IMAP
  16. Chapter 16 Telnet and SSH
  17. Chapter 18 RPC

FAQ

这本书的作者和中文版信息是什么?
原书《Foundations of Python Network Programming》由 Brandon Rhodes 与 John Goerzen 合著,中文第3版由诸豪文翻译,人民邮电出版社 2016 年 9 月出版,属「图灵程序设计丛书」,ISBN 为 978-7-115-43350-3,定价 79 元。
书里的代码是用 Python 2 还是 Python 3?
全部采用 Python 3 编写,并且专门介绍了 Python 3 中新提供的 SSL 支持以及异步 I/O 事件循环的编写方法,因此在 Python 3 环境下无需做兼容性改写。
读这本书需要什么基础?
需要能熟练读写 Python 基本语法(函数、类、异常处理、文件操作),并对 TCP/IP 有最粗浅的印象。完全没有网络概念也能读,因为第1章从协议栈讲起,但零编程基础会非常吃力。
这本书适合当网络编程的入门第一本吗?
更适合作为「第二本」。它能补上大多数教程缺失的协议原理与套接字细节,但如果连 HTTP 请求、套接字是什么都没概念,建议先读一本更偏实战入门的书,再回来读这本深入。
为什么目录里没有第17章?
中文版目录在部分图书馆书目记录中第16章后直接接第18章 RPC,属于原书章节编排或记录缺漏,实际章节以纸书正文为准,不影响整体知识结构的连贯阅读。

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.

Top rated in the same category