示例#1
0
文件: rpc.py 项目: 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)
示例#2
0
文件: rpc.py 项目: 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)
示例#3
0
文件: tcp.py 项目: stonegithubs/torpc
 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)
示例#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)