コード例 #1
0
 def discover(self, service):
     from rpyc.utils.factory import unix_connect, connect
     if self.discoverer is None or self.discoverer.closed:
         try:
             if self.path:
                 self.discoverer = unix_connect(self.path)
             else:
                 self.discoverer = connect(self.host, self.port)
         except:
             raise DiscoveryError('Discovery service not found.')
     info = dict(self.discoverer.root.discover(service))
     if info is not None:
         if 'socket_path' in info:
             return unix_connect(info.get('socket_path'))
         else:
             return connect(info.get('hostname'), info.get('port'))
     else:
         raise DiscoveryError('Service discovery failed.')
コード例 #2
0
ファイル: driver.py プロジェクト: pborky/webkit-scraper
 def discover(self, service):
     from rpyc.utils.factory import unix_connect, connect
     if self.discoverer is None or self.discoverer.closed:
         try:
             if self.path:
                 self.discoverer = unix_connect(self.path)
             else:
                 self.discoverer = connect(self.host, self.port)
         except:
             raise DiscoveryError('Discovery service not found.')
     info = dict(self.discoverer.root.discover(service))
     if info is not None:
         if 'socket_path' in info:
             return unix_connect(info.get('socket_path'))
         else:
             return connect(info.get('hostname'), info.get('port'))
     else:
         raise DiscoveryError('Service discovery failed.')
コード例 #3
0
def connect(host, port=DEFAULT_SERVER_PORT, ipv6=False):
    """
    Creates a socket connection to the given host and port.
    
    :param host: the host to connect to
    :param port: the TCP port
    :param ipv6: whether to create an IPv6 socket or IPv4
    
    :returns: an RPyC connection exposing ``SlaveService``
    """
    return factory.connect(host, port, SlaveService, ipv6=ipv6)
コード例 #4
0
ファイル: classic.py プロジェクト: chris-/rpyc
def connect(host, port=DEFAULT_SERVER_PORT, ipv6=False):
    """
    Creates a socket connection to the given host and port.
    
    :param host: the host to connect to
    :param port: the TCP port
    :param ipv6: whether to create an IPv6 socket or IPv4
    
    :returns: an RPyC connection exposing ``SlaveService``
    """
    return factory.connect(host, port, SlaveService, ipv6=ipv6)
コード例 #5
0
ファイル: classic.py プロジェクト: delattj/rpyc
def connect(host, port = DEFAULT_SERVER_PORT):
    """creates a socket connection to the given host and port"""
    return factory.connect(host, port, SlaveService)
コード例 #6
0
ファイル: classic.py プロジェクト: thomashigdon/rpyc
def connect(host, port=DEFAULT_SERVER_PORT):
    """creates a socket connection to the given host and port"""
    return factory.connect(host, port, SlaveService)