Exemplo n.º 1
0
Arquivo: rpc.py Projeto: yoki123/torpc
    def __init__(self, address, rpc_name='', service_cls=None, request_timeout=0):
        if callable(service_cls):
            self.service = service_cls()
        else:
            self.service = Services()

        self.rpc_name = rpc_name

        sock = auto_build_socket(address)

        self._conn = RPCConnection(sock, self.service, request_timeout=request_timeout)
        self._conn.set_close_callback(self.on_closed)
        self._conn.connect(address, self.on_connected)

        if self.rpc_name:
            self._conn.register(self.rpc_name, self._register_callback)
Exemplo n.º 2
0
Arquivo: rpc.py Projeto: dikoufu/torpc
    def __init__(self,
                 address,
                 rpc_name='',
                 service_cls=None,
                 request_timeout=0):
        if callable(service_cls):
            self.service = service_cls()
        else:
            self.service = Services()

        self.rpc_name = rpc_name

        sock = auto_build_socket(address)

        self._conn = RPCConnection(sock,
                                   self.service,
                                   request_timeout=request_timeout)
        self._conn.set_close_callback(self.on_closed)
        self._conn.connect(address, self.on_connected)

        if self.rpc_name:
            self._conn.register(self.rpc_name, self._register_callback)
Exemplo n.º 3
0
 def start(self):
     sock = auto_build_socket(self._address)
     self.conn = Connection(sock)
     self.conn.set_close_callback(self.on_close)
     self.conn.connect(self._address, self.on_connected)
     self.conn.read_util_close(self.on_receive)
Exemplo n.º 4
0
 def start(self):
     sock = auto_build_socket(self._address)
     self.conn = Connection(sock)
     self.conn.set_close_callback(self.on_close)
     self.conn.connect(self._address, self.on_connected)
     self.conn.read_util_close(self.on_receive)