예제 #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
 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
def connect(host, port=DEFAULT_SERVER_PORT):
    """creates a socket connection to the given host and port"""
    return factory.connect(host, port, SlaveService)