The next thing we need to define is Client, which will do the job of first connecting to our listener, and then print whatever we send from our Listener process.
We first have to import the Client class from our multiprocess.connection module. We then again utilize the Client class as a context manager passing in the address we wish to connect to as well as authkey that we've already defined on our Listener class.
Upon successful connection, we then print everything we receive from our Listener class. We do this in a variety of ways to showcase the flexibility of the connection module:
from multiprocessing.connection import Client
from array import array
address = ('localhost', 6000)
with Client(address, authkey=b'secret password') as conn:
print(conn.recv()) # => [2.25, None, 'junk', float]
print(conn.recv_bytes()) # => 'hello'
arr = array('i', [0, 0, 0, 0, 0])
print(conn.recv_bytes_into(arr)) # => 8
print(arr) # => array('i', [42, 1729, 0, 0, 0])