Concurrency and Process Modules

multiprocessing.connection

Message-oriented connection endpoints for exchanging bytes or serialized Python objects. Pipe endpoints support local communication; Listener and Client support address-based connections. recv can unpickle data, so only receive serialized objects from trusted peers. This example transfers bytes in one process.

Formal Syntax & Structure

python syntaxpython
import multiprocessing.connection

Return Value

module

Module namespace available through import; import is a statement, not a value-returning expression.

Working Example

Example Snippetpython
from multiprocessing import Pipereader, writer = Pipe(duplex=False)try:    writer.send_bytes(b"tea")    print(reader.recv_bytes())finally:    reader.close()    writer.close()
Python Reference