import sys from multiprocessing import * if sys.version_info < (3, 0): latin = str else: def latin(s): return s.encode('ascii') SENTINEL = latin('') def _echo(self, conn): for msg in iter(conn.recv_bytes, SENTINEL): conn.send_bytes(msg) conn.close() conn, child_conn = Pipe() p = Process(target=_echo, args=(child_conn,)) #p.set_daemon(True) p.start() really_big_msg = latin('X') * 10 #(1024 * 1024 * 32) conn.send_bytes(really_big_msg) assert conn.recv_bytes() == really_big_msg conn.send_bytes(SENTINEL) # tell child to quit child_conn.close()