17. Interprocess Communication and Networking ********************************************* The modules described in this chapter provide mechanisms for different processes to communicate. Some modules only work for two processes that are on the same machine, e.g. "signal" and "subprocess". Other modules support networking protocols that two or more processes can use to communicate across machines. The list of modules described in this chapter is: * 17.1. "subprocess" — Subprocess management * 17.1.1. Using the "subprocess" Module * 17.1.1.1. Frequently Used Arguments * 17.1.1.2. Popen Constructor * 17.1.1.3. Exceptions * 17.1.1.4. Security * 17.1.2. Popen Objects * 17.1.3. Windows Popen Helpers * 17.1.3.1. Constants * 17.1.4. Replacing Older Functions with the "subprocess" Module * 17.1.4.1. Replacing /bin/sh shell backquote * 17.1.4.2. Replacing shell pipeline * 17.1.4.3. Replacing "os.system()" * 17.1.4.4. Replacing the "os.spawn" family * 17.1.4.5. Replacing "os.popen()", "os.popen2()", "os.popen3()" * 17.1.4.6. Replacing functions from the "popen2" module * 17.1.5. Notes * 17.1.5.1. Converting an argument sequence to a string on Windows * 17.2. "socket" — Low-level networking interface * 17.2.1. Socket Objects * 17.2.2. Example * 17.3. "ssl" — TLS/SSL wrapper for socket objects * 17.3.1. Functions, Constants, and Exceptions * 17.3.1.1. Socket creation * 17.3.1.2. Context creation * 17.3.1.3. Random generation * 17.3.1.4. Certificate handling * 17.3.1.5. Constants * 17.3.2. SSL Sockets * 17.3.3. SSL Contexts * 17.3.4. Certificates * 17.3.4.1. Certificate chains * 17.3.4.2. CA certificates * 17.3.4.3. Combined key and certificate * 17.3.4.4. Self-signed certificates * 17.3.5. Examples * 17.3.5.1. Testing for SSL support * 17.3.5.2. Client-side operation * 17.3.5.3. Server-side operation * 17.3.6. Notes on non-blocking sockets * 17.3.7. Security considerations * 17.3.7.1. Best defaults * 17.3.7.2. Manual settings * 17.3.7.2.1. Verifying certificates * 17.3.7.2.2. Protocol versions * 17.3.7.2.3. Cipher selection * 17.3.7.3. Multi-processing * 17.3.8. LibreSSL support * 17.4. "signal" — Set handlers for asynchronous events * 17.4.1. Example * 17.5. "popen2" — Subprocesses with accessible I/O streams * 17.5.1. Popen3 and Popen4 Objects * 17.5.2. Flow Control Issues * 17.6. "asyncore" — Asynchronous socket handler * 17.6.1. asyncore Example basic HTTP client * 17.6.2. asyncore Example basic echo server * 17.7. "asynchat" — Asynchronous socket command/response handler * 17.7.1. asynchat - Auxiliary Classes * 17.7.2. asynchat Example