Foundations of Python Network Programming cover

Foundations of Python Network Programming

No rating yet
Word count
700K words
ISBN
9787121044953

Tags

Summary

This book is the Chinese translation of Foundations of Python Network Programming. Centered on the theme of "writing network programs in Python," it is aimed at readers who already know Python syntax and wish to enter the field of network programming. The book follows a progression from basic to advanced material. Part I covers the fundamental design of clients and servers, the foundation of all network applications, including socket operations, UDP and TCP communication, domain name resolution and DNS queries, and fetching web pages, and it discusses the use of IPv6 in practical programs. Part II turns to specific application protocols, explaining how to write programs that send and receive email, serve static and dynamic web pages, and transfer files, covering Python implementations of common protocols such as SMTP, POP, IMAP, HTTP, and FTP, and also introducing the building of web applications with Apache's mod_python. Part III focuses on the server side and concurrency, covering multitasking and non-blocking I/O and how to write servers that can serve many clients simultaneously, including forking, threading, and asynchronous communication models, and introduces server-side frameworks such as SocketServer, SimpleXMLRPCServer, and CGI, as well as SSL, XML and Web Services, and database client access. The book emphasizes hands-on practice, with about 175 complete examples and more than 6,600 lines of runnable code, so that readers can understand the correspondence between network protocols and programming models through imitation and modification. Owing to the era in which it was written, the examples are based on Python 2.x and the library ecosystem of the time, and readers should migrate them in light of current versions.

Editor's review

如果你已经会写 Python 脚本,却一碰到套接字、协议握手、并发服务器就觉得无从下手,这本书正好补上这段断层。它不空谈原理,而是把每个网络概念都落到可直接运行的代码上:约 175 个实例、6600 多行代码,覆盖从 UDP/TCP 套接字、DNS 查询、HTTP 取页,到邮件收发、FTP 传输、mod_python 建站,再到 Forking、线程与异步 I/O 的服务端并发模型,几乎是一部“网络编程零件库”。作者的讲解思路清晰,先讲清协议在做什么,再给出 Python 实现,最后指出常见坑,适合边读边敲。需要提醒的是,本书原版成书较早,示例以 Python 2.x 为主,部分库与框架(如 mod_python)今已少用,但协议原理与编程模型的讲解并不过时。把它当作理解网络编程底层逻辑的入门读物,配合迁移到 Python 3 的实践,收获会更大。

Who it's for

A good fit for

  • 已掌握 Python 基本语法、想系统学习网络编程的初学者
  • 需要理解 TCP/UDP、DNS、HTTP、邮件等协议实现细节的开发者
  • 高校网络编程、计算机网络课程的学生与授课教师
  • 从事运维、后端开发,需要自己写网络工具脚本的工程师

Not a good fit for

  • 完全没有编程基础、尚未写过 Python 程序的零基础读者
  • 只想学习 Web 框架(如 Django/Flask)快速建站的读者
  • 只寻求 Python 3 及最新异步框架(如 asyncio)实战内容的读者

Reading tips

  1. 先通读第一部分的套接字与 DNS 内容,动手复现示例,建立客户端/服务器的基本直觉。
  2. 按协议专题挑读:需要写邮件或抓网页时直接跳到对应章节,边改代码边验证。
  3. 书中示例多为 Python 2 代码,建议同步用 Python 3 重写,顺带理解 bytes 与 str、编码的变化。
  4. 读完并发章节后,用 threading 或 asyncio 重写一个简单服务器,对比不同模型的优劣。

About the publisher

Publishing House of Electronics Industry China · Founded in 1982

The Publishing House of Electronics Industry is a comprehensive publisher distinguished by its focus on electronic information and related fields. Judging from the more than 3,000 titles in its catalogue, its publishing covers programming and design, artificial intelligence, computer science, finance and economics, photography, and social sciences, attending both to cutting-edge technology and to general readers. Representative titles include Factor Investing: Methods and Practice, x86 Assembly Language: From Real Mode to Protected Mode, The RISC-V Reader, Artificial Intelligence: Speech Recognition, Understanding and Practice, Phased Array Radar Technology, Radar Target Characteristics, and 100 Go Mistakes and How to Avoid Them, most of which centre on technical methods and engineering practice. Its authors include Shi Chuan, Li Zhong, Wang Xiaobo, David Patterson, Andrew Waterman, and Yu Zihao, among others from China and abroad. Owing to limited public information, no further publishing features are elaborated here.

FAQ

这本书和《Python 网络编程》(第3版)是同一本吗?
不是。本书是 2007 年电子工业出版社出版的《Foundations of Python Network Programming》初版中译本,作者为 John Goerzen,译者为莫迟;2016 年人民邮电出版社出版的《Python 网络编程(第3版)》由 Brandon Rhodes 与 John Goerzen 合著,内容与所用 Python 版本均有较大更新。
零基础可以直接读这本书吗?
不太建议。书中默认读者已熟悉 Python 语法与基本库使用,直接讲套接字、协议和多任务处理。零基础读者宜先学完 Python 入门内容,再来阅读本书会更顺畅。
书中的代码现在还能直接运行吗?
书中示例主要基于 Python 2.x,部分模块与框架(如 mod_python)已过时。协议原理与编程思路仍然适用,但代码需按 Python 3 做语法、编码和库 API 的迁移后才能运行。
这本书更偏理论还是实践?
偏实践。全书配有约 175 个完整实例、6600 行以上代码,先说明协议与场景,再给出可运行的实现,适合边读边敲、边改边学。

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