
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 "mmap".  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:

* "socket" --- Low-level networking interface

  * Socket families

  * Module contents

    * Exceptions

    * Constants

    * Functions

      * Creating sockets

      * Other functions

  * Socket Objects

  * Notes on socket timeouts

    * Timeouts and the "connect" method

    * Timeouts and the "accept" method

  * Example

* "ssl" --- TLS/SSL wrapper for socket objects

  * Functions, Constants, and Exceptions

    * Socket creation

    * Context creation

    * Random generation

    * Certificate handling

    * Constants

  * SSL Sockets

  * SSL Contexts

  * Certificates

    * Certificate chains

    * CA certificates

    * Combined key and certificate

    * Self-signed certificates

  * Examples

    * Testing for SSL support

    * Client-side operation

    * Server-side operation

  * Notes on non-blocking sockets

  * Security considerations

    * Best defaults

    * Manual settings

      * Verifying certificates

      * Protocol versions

      * Cipher selection

    * Multi-processing

* "select" --- Waiting for I/O completion

  * "/dev/poll" Polling Objects

  * Edge and Level Trigger Polling (epoll) Objects

  * Polling Objects

  * Kqueue Objects

  * Kevent Objects

* "selectors" -- High-level I/O multiplexing

  * Introduction

  * Classes

  * Examples

* "asyncio" -- Asynchronous I/O, event loop, coroutines and tasks

  * Event loops

    * Event loop policies and the default policy

    * Event loop functions

    * Event loop policy interface

    * Access to the global loop policy

    * Run an event loop

    * Calls

    * Delayed calls

    * Creating connections

    * Creating listening connections

    * Watch file descriptors

    * Low-level socket operations

    * Resolve host name

    * Connect pipes

    * UNIX signals

    * Executor

    * Error Handling API

    * Debug mode

    * Server

    * Handle

    * Example: Hello World (callback)

    * Example: Set signal handlers for SIGINT and SIGTERM

  * Tasks and coroutines

    * Coroutines

      * Example: "Hello World" coroutine

      * Example: Chain coroutines

    * InvalidStateError

    * Future

      * Example: Future with run_until_complete()

      * Example: Future with run_forever()

    * Task

      * Example: Parallel execution of tasks

    * Task functions

  * Transports  and protocols (low-level API)

    * Transports

      * BaseTransport

      * ReadTransport

      * WriteTransport

      * DatagramTransport

      * BaseSubprocessTransport

    * Protocols

      * Protocol classes

      * Connection callbacks

      * Streaming protocols

      * Datagram protocols

      * Flow control callbacks

      * Coroutines and protocols

    * Protocol example: TCP echo server and client

      * Echo client

      * Echo server

  * Streams (high-level API)

    * Stream functions

    * StreamReader

    * StreamWriter

    * StreamReaderProtocol

    * IncompleteReadError

    * Example

  * Subprocess

    * Operating system support

    * Create a subprocess: high-level API using Process

    * Create a subprocess: low-level API using subprocess.Popen

    * Constants

    * Process

    * Example

  * Synchronization primitives

    * Locks

      * Lock

      * Event

      * Condition

    * Semaphores

      * Semaphore

      * BoundedSemaphore

    * Queues

      * Queue

      * PriorityQueue

      * LifoQueue

      * JoinableQueue

      * Exceptions

  * Develop with asyncio

    * Concurrency and multithreading

    * Handle blocking functions correctly

    * Logging

    * Detect coroutine objects never scheduled

    * Detect exceptions not consumed

    * Chain coroutines correctly

* "asyncore" --- Asynchronous socket handler

  * asyncore Example basic HTTP client

  * asyncore Example basic echo server

* "asynchat" --- Asynchronous socket command/response handler

  * asynchat - Auxiliary Classes

  * asynchat Example

* "signal" --- Set handlers for asynchronous events

  * General rules

    * Execution of Python signal handlers

    * Signals and threads

  * Module contents

  * Example

* "mmap" --- Memory-mapped file support
