Exemple #1
0
def connect_stdpipes(service=VoidService, config={}):
    """
    creates a connection over the standard input/output pipes

    :param service: the local service to expose (defaults to Void)
    :param config: configuration dict

    :returns: an RPyC connection
    """
    return connect_stream(PipeStream.from_std(), service=service, config=config)
Exemple #2
0
def connect_pipes(input, output, service=VoidService, config={}):
    """
    creates a connection over the given input/output pipes

    :param input: the input pipe
    :param output: the output pipe
    :param service: the local service to expose (defaults to Void)
    :param config: configuration dict

    :returns: an RPyC connection
    """
    return connect_stream(PipeStream(input, output), service=service, config=config)
Exemple #3
0
 def test_rpyc(self):
     p1, p2 = PipeStream.create_pair()
     client = rpyc.connect_stream(p1)
     server = rpyc.connect_stream(p2)
     server_thread = rpyc.spawn(server.serve_all)
     assert client.root.get_service_name() == "VOID"
     t = rpyc.BgServingThread(client)
     assert server.root.get_service_name() == "VOID"
     t.stop()
     client.close()
     server.close()
     server_thread.join()
Exemple #4
0
 def test_basic_io(self):
     p1, p2 = PipeStream.create_pair()
     p1.write(BYTES_LITERAL("hello"))
     assert p2.poll(0)
     assert p2.read(5) == BYTES_LITERAL("hello")
     assert not p2.poll(0)
     p2.write(BYTES_LITERAL("world"))
     assert p1.poll(0)
     assert p1.read(5) == BYTES_LITERAL("world")
     assert not p1.poll(0)
     p1.close()
     p2.close()
 def test_basic_io(self):
     p1, p2 = PipeStream.create_pair()
     p1.write(BYTES_LITERAL("hello"))
     assert p2.poll(0)
     assert p2.read(5) == BYTES_LITERAL("hello")
     assert not p2.poll(0)
     p2.write(BYTES_LITERAL("world"))
     assert p1.poll(0)
     assert p1.read(5) == BYTES_LITERAL("world")
     assert not p1.poll(0)
     p1.close()
     p2.close()
Exemple #6
0
 def test_rpyc(self):
     p1, p2 = PipeStream.create_pair()
     client = rpyc.connect_stream(p1)
     server = rpyc.connect_stream(p2)
     server_thread = rpyc.spawn(server.serve_all)
     assert client.root.get_service_name() == "VOID"
     t = rpyc.BgServingThread(client)
     assert server.root.get_service_name() == "VOID"
     t.stop()
     client.close()
     server.close()
     server_thread.join()