Read into buffer a complete message of byte data sent from the other end of the
connection and return the number of bytes in the message. Blocks until there is
something to receive. Raises
if there is nothing left to receive and the
other end was closed.
buffer must be an object satisfying the writable buffer interface. If offset is given
then the message will be written into the buffer from that position. Offset must be
a non-negative integer less than the length of buffer (in bytes).
If the buffer is too short then a
exception is raised and the
complete message is available as
is the exception instance.
>>> from multiprocessing import Pipe
>>> a, b = Pipe()
>>> a.send([1, 'hello', None])
[1, 'hello', None]
>>> b.send_bytes('thank you')
>>> import array
>>> arr1 = array.array('i', range(5))
>>> arr2 = array.array('i',  * 10)
>>> count = b.recv_bytes_into(arr2)
>>> assert count == len(arr1) * arr1.itemsize
array('i', [0, 1, 2, 3, 4, 0, 0, 0, 0, 0])
method automatically unpickles the data it receives,
which can be a security risk unless you can trust the process which sent the message.
Therefore, unless the connection object was produced using
you should only
methods after performing some sort of authentication. See
Warning: If a process is killed while it is trying to read or write to a pipe then the data
in the pipe is likely to become corrupted, because it may become impossible to be sure
where the message boundaries lie.
126.96.36.199. Synchronization primitives