Exemple #1
0
def main():
    import warnings
    warnings.simplefilter("ignore", DeprecationWarning)

    try:
        port = int(sys.argv[1])
    except:
        port = DEFAULT_SERVER_PORT

    conn = None
    if port > 19000:
        # Named server
        try:
            __import__("win32file")
            np_server = NamedPipeStream.create_server(str(port))
            conn = connect_stream(np_server, ModSlaveService)
            try:
                conn.serve_all()
            except Exception:
                pass
            finally:
                if (conn is not None) and not conn.closed:
                    conn.close()
                exit()
        except SystemExit:
            raise
        except:
            conn = None

    if conn is None:
        t = SimpleServer(ModSlaveService, port=port, auto_register=False)
        t.start()
def main():
    """
    Initialize rpyc connection.
    """
    # Don't compress to improve speed.
    rpyc.core.channel.Channel.COMPRESSION_LEVEL = 0

    # Importing idc here so we can still import the server externally.
    import idc

    if not idc.ARGV[1:]:
        raise RuntimeError(f"No connection parameter provided.")

    if sys.platform == "win32":
        pipe_name = idc.ARGV[1]
        stream = NamedPipeStream.create_server(pipe_name)
        with rpyc.classic.connect_stream(stream) as srv:
            srv.serve_all()
    else:
        socket_path = idc.ARGV[1]
        server = OneShotServer(SlaveService,
                               socket_path=socket_path,
                               auto_register=False)
        server.start()

    idc.qexit(0)
Exemple #3
0
 def pipe_server(self):
     self.np_server = NamedPipeStream.create_server("floop")
     self.server = rpyc.connect_stream(self.np_server)
     self.server.serve_all()
 def pipe_server(self):
     self.np_server = NamedPipeStream.create_server("floop")
     self.server = rpyc.connect_stream(self.np_server)
     self.server.serve_all()