コード例 #1
0
        def _succeed(address):
            #Discovery succeeded
            self.host, self.port = address
            #self.address = Address(self.host, self.port)
            discovery_deferred.callback((self.host, self.port))
            print "discovevry found address %s:%d" % (self.host, self.port)
            
            stun.printConfiguration()
            #print stun.getConfiguration()
            #print stun.getNATType(), stun.getPrivateAddress(), stun.getPublicAddress()
            netconf = stun.getConfiguration()

            d, puncher = punch.HolePunching(port, reactor, netconf, id)
            d.addCallback(_registrationMade)
            d.addErrback(_fail)
コード例 #2
0
 def _fail(failure):
     # Discovery failed => try next discovery method
     stun.printConfiguration()
     print failure