
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

  * Base Event Loop

    * Run an event loop

    * Calls

    * Delayed calls

    * Tasks

    * 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

    * Event loop examples

      * Hello World with call_soon()

      * Display the current date with call_later()

      * Watch a file descriptor for read events

      * Set signal handlers for SIGINT and SIGTERM

  * Event loops

    * Event loop functions

    * Available event loops

    * Platform support

      * Windows

      * Mac OS X

    * Event loop policies and the default policy

    * Event loop policy interface

    * Access to the global loop policy

  * Tasks and coroutines

    * Coroutines

      * Example: Hello World coroutine

      * Example: Coroutine displaying the current date

      * Example: Chain coroutines

    * InvalidStateError

    * TimeoutError

    * Future

      * Example: Future with run_until_complete()

      * Example: Future with run_forever()

    * Task

      * Example: Parallel execution of tasks

    * Task functions

  * Transports  and protocols (callback based API)

    * Transports

      * BaseTransport

      * ReadTransport

      * WriteTransport

      * DatagramTransport

      * BaseSubprocessTransport

    * Protocols

      * Protocol classes

      * Connection callbacks

      * Streaming protocols

      * Datagram protocols

      * Flow control callbacks

      * Coroutines and protocols

    * Protocol examples

      * TCP echo client protocol

      * TCP echo server protocol

      * UDP echo client protocol

      * UDP echo server protocol

      * Register an open socket to wait for data using a protocol

  * Streams (coroutine based API)

    * Stream functions

    * StreamReader

    * StreamWriter

    * StreamReaderProtocol

    * IncompleteReadError

    * Stream examples

      * TCP echo client using streams

      * TCP echo server using streams

      * Get HTTP headers

      * Register an open socket to wait for data using streams

  * Subprocess

    * Windows event loop

    * Create a subprocess: high-level API using Process

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

    * Constants

    * Process

    * Subprocess and threads

    * Subprocess examples

      * Subprocess using transport and protocol

      * Subprocess using streams

  * Synchronization primitives

    * Locks

      * Lock

      * Event

      * Condition

    * Semaphores

      * Semaphore

      * BoundedSemaphore

  * Queues

    * Queue

    * PriorityQueue

    * LifoQueue

      * JoinableQueue

      * Exceptions

  * Develop with asyncio

    * Debug mode of asyncio

    * Cancellation

    * Concurrency and multithreading

    * Handle blocking functions correctly

    * Logging

    * Detect coroutine objects never scheduled

    * Detect exceptions never consumed

    * Chain coroutines correctly

    * Pending task destroyed

    * Close transports and event loops

* "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
