fopnp
所属分类:Python编程
开发工具:Python
文件大小:0KB
下载次数:0
上传日期:2023-03-29 16:48:11
上 传 者:
sh-1993
说明: Python网络编程基础(Apress)-脚本和示例,
(Foundations of Python Network Programming (Apress) — scripts and examples,)
文件列表:
fopnp-m/ (0, 2023-10-29)
fopnp-m/FUNDING.yml (23, 2023-10-29)
fopnp-m/diagrams/ (0, 2023-10-29)
fopnp-m/diagrams/08-queues.dot (358, 2023-10-29)
fopnp-m/diagrams/10-architectures.dot (1587, 2023-10-29)
fopnp-m/diagrams/13-smtp.diag (1238, 2023-10-29)
fopnp-m/diagrams/14-pop.diag (853, 2023-10-29)
fopnp-m/diagrams/15-imap.diag (836, 2023-10-29)
fopnp-m/diagrams/17-ftp.diag (1383, 2023-10-29)
fopnp-m/diagrams/Makefile (871, 2023-10-29)
fopnp-m/diagrams/fixup.py (986, 2023-10-29)
fopnp-m/diagrams/playground.dot (1622, 2023-10-29)
fopnp-m/diagrams/playground.png (38834, 2023-10-29)
fopnp-m/playground/ (0, 2023-10-29)
fopnp-m/playground/Vagrantfile (180, 2023-10-29)
fopnp-m/playground/base/ (0, 2023-10-29)
fopnp-m/playground/base/Dockerfile (2220, 2023-10-29)
fopnp-m/playground/base/ca.crt (1939, 2023-10-29)
fopnp-m/playground/base/startup.sh (1027, 2023-10-29)
fopnp-m/playground/bootstrap.sh (351, 2023-10-29)
fopnp-m/playground/build.sh (1255, 2023-10-29)
fopnp-m/playground/certs/ (0, 2023-10-29)
fopnp-m/playground/certs/01.pem (5703, 2023-10-29)
fopnp-m/playground/certs/02.pem (5683, 2023-10-29)
fopnp-m/playground/certs/03.pem (5688, 2023-10-29)
fopnp-m/playground/certs/04.pem (5689, 2023-10-29)
fopnp-m/playground/certs/05.pem (5688, 2023-10-29)
fopnp-m/playground/certs/Makefile (1300, 2023-10-29)
fopnp-m/playground/certs/ca.cnf (978, 2023-10-29)
fopnp-m/playground/certs/ca.crt (1939, 2023-10-29)
fopnp-m/playground/certs/ca.key (2455, 2023-10-29)
fopnp-m/playground/certs/ca.pem (4394, 2023-10-29)
fopnp-m/playground/certs/ca_certificates.db (912, 2023-10-29)
fopnp-m/playground/certs/ca_certificates.db.attr (21, 2023-10-29)
fopnp-m/playground/certs/ca_serial.txt (3, 2023-10-29)
fopnp-m/playground/certs/client.cnf (609, 2023-10-29)
fopnp-m/playground/certs/client.crt (5703, 2023-10-29)
... ...
# Foundations of Python Network Programming
Welcome!
This GitHub repository offers all of the example Python code from the
Third Edition of *Foundations of Python Network Programming* as revised by
[Brandon Rhodes](http://rhodesmill.org/brandon/) for Python3:
From Amazon.com (affiliate link)
From Apress (the publisher)
Each chapter’s source code lives in its own directory:
* [Chapter 1: Introduction to Client-Server Networking](py3/chapter01#readme)
* [Chapter 2: UDP](py3/chapter02#readme)
* [Chapter 3: TCP](py3/chapter03#readme)
* [Chapter 4: Socket Names and DNS](py3/chapter04#readme)
* [Chapter 5: Network Data and Network Errors](py3/chapter05#readme)
* [Chapter 6: TLS/SSL](py3/chapter06#readme)
* [Chapter 7: Server Architecture](py3/chapter07#readme)
* [Chapter 8: Caches and Message Queues](py3/chapter08#readme)
* [Chapter 9: HTTP Clients](py3/chapter09#readme)
* [Chapter 10: HTTP Servers](py3/chapter10#readme)
* [Chapter 11: The World Wide Web](py3/chapter11#readme)
* [Chapter 12: Building and Parsing E-Mail](py3/chapter12#readme)
* [Chapter 13: SMTP](py3/chapter13#readme)
* [Chapter 14: POP](py3/chapter14#readme)
* [Chapter 15: IMAP](py3/chapter15#readme)
* [Chapter 16: Telnet and SSH](py3/chapter16#readme)
* [Chapter 17: FTP](py3/chapter17#readme)
* [Chapter 18: RPC](py3/chapter18#readme)
## Most of this works under Python 2
If you are still using Python2, you will still benefit from studying
these examples as they are more carefully designed than the scripts in
the previous edition and also use more modern third-party libraries.
The `README.md` inside each chapter directory — which GitHub will
display automatically when you click a chapter title in the Table of
Contents above — has a paragraph near the top stating whether the
scripts work with Python2 or not. Typically each script needs only a
quick run through the [3to2](https://pypi.python.org/pypi/3to2) tool in
order to operate flawlessly under the old version of the language.
The exceptions are:
* The TLS/SSL examples in Chapter6 are specific to Python3.4 and
later because only with that version of the language did the `ssl`
module gain safe enough defaults to be recommended for use with
secure services. (An effort to backport these features to
Python2.7, however, does seem to be underway.)
* Two of the scripts in Chapter8 run into a snag if translated to
Python2 because of modules that have switched whether they want to
operate on bytes or on Unicode strings.
* The `email` scripts in Chapter12 use a new and more convenient API
that was added to the language in Python3.4.
The other changes between Python2 and3 will be handled automatically
by 3to2: `print()` is now a function, plain `b'byte strings'` now take a
leading `b`, and many Standard Library modules were renamed during the
transition.
## The Network Playground
Many novice network programmers do not have interesting networks to
explore — many homes have only a laptop plus a broadband modem to which
the homeowner does not have access.
To remedy this situation, I have developed an entire [Network
Playground](playground) consisting of more than a half dozen hosts
providing services from SSH and Telnet to a web server andFTP. The
“hosts” are built using Docker, and I hope soon to package the whole
thing up as a virtual machine that users can download.
The result will be that the user can get a prompt from which they can
connect out to the `example.com` server farm and talk to all kinds of
network services. And just as in a real network, they will find that
these machines are several hops away — hops that can be inspected by
normal networking tools like `traceroute`:
```
$ ssh h1
# traceroute www.example.com
traceroute to www.example.com (10.130.1.4), 30 hops max, 60 byte packets
1 192.168.1.1 (192.168.1.1) 0.513 ms 0.208 ms 0.265 ms
2 isp (10.25.1.1) 0.544 ms 0.220 ms 0.115 ms
3 backbone (10.1.1.1) 0.364 ms 0.227 ms 0.252 ms
4 example.com (10.130.1.1) 0.617 ms 0.355 ms 0.407 ms
5 www.example.com (10.130.1.4) 1.301 ms 0.415 ms 0.522 ms
```
You can find the instructions here: [The Network Playground](playground).
近期下载者:
相关文件:
收藏者: