コード例 #1
0
ファイル: aetherProtocol.py プロジェクト: roclin-grp/aether
def connectWithIP(ip, Port):
    print('Connect with Ip: %s:%s' % (ip, Port))
    endpoint = SSL4ClientEndpoint(reactor, ip, int(Port),
                                  globals.AetherClientContextFactory())
    endpoint.connect(aetherProtocolFactoryInstance)\
        .addCallback(lambda p: p.initiateHandshake())\
        .addErrback(printError,
            'Connection failed because node at the address %s is not responding.'%ip)
コード例 #2
0
def connectWithIP(IP, Port):
    cprint('CONNECT WITH IP IS CALLED FOR THE ADDRESS %s:%s' % (IP, Port),
           'white', 'on_red')
    endpoint = SSL4ClientEndpoint(reactor, IP, Port,
                                  globals.AetherClientContextFactory())
    endpoint.connect(AetherProtocolFactory())\
        .addCallback(lambda p: p.initiateHandshake())\
        .addErrback(printError,
            'Connection failed because node at the address %s:%s is not responding to or actively '
            'refusing the connection request. It can be offline or permanently dead.'
            %(IP, Port))
コード例 #3
0
def connectWithNode(node):
    ip = node['LastConnectedIP'] if node['LastConnectedIP'] != None else node[
        'LastRetrievedIP']
    port = node['LastConnectedPort'] if node[
        'LastConnectedPort'] != None else node['LastRetrievedPort']
    endpoint = SSL4ClientEndpoint(reactor, ip, port,
                                  globals.AetherClientContextFactory())
    endpoint.connect(AetherProtocolFactory())\
        .addCallback(lambda p: p.initiateHandshake())\
        .addErrback(printError,
                'Connection failed because node  %s at the address %s:%s is not responding to or actively '
                'refusing the connection request. It can be offline or permanently dead.'
                %(node['NodeId'], ip, port))