6. windows.pipe – Inter-Process Communication

windows.pipe is wrapper around _multiprocessing.PipeConnection simplifiying its use.

The main improvement are:

  • send/recv object from a pipe name in one line
  • Context manager around pipe connection

Note

see sample windows.pipe

6.1. Helper functions

windows.pipe.create(addr, security_descriptor=None)

Create a namedpipe pipe addr

Returns type:PipeConnection
windows.pipe.connect(addr)

Connect to the named pipe addr

Returns type:PipeConnection
windows.pipe.recv_object(addr)[source]

Receive an object from pipe addr

windows.pipe.send_object(addr, obj)[source]

Send obj on pipe addr

windows.pipe.full_pipe_address(addr)[source]

Return the full address of the pipe addr

6.2. PipeConnection

class windows.pipe.PipeConnection(connection, name=None, server=False)[source]

A wrapper arround _multiprocessing.PipeConnection able to work as a ContextManager

close()[source]

Close the handle of the pipe

classmethod connect(addr)[source]

Connect to the named pipe addr

Returns type:PipeConnection
classmethod create(addr, security_descriptor=None)[source]

Create a namedpipe pipe addr

Returns type:PipeConnection
classmethod from_handle(phandle, *args, **kwargs)[source]

Create a PipeConnection from pipe handle phandle

recv(*args, **kwargs)[source]

Send an object from the pipe

send(*args, **kwargs)[source]

Send an object on the pipe

wait_connection()[source]

Wait for a client process to connect to the named pipe