Exemplo n.º 1
0
	def resolve(self, name, timeout = (1, 3, 11, 45)):
		"""Return a Deferred that will resolve a hostname.
		"""
		if not name:
			# XXX - This is *less than* '::', and will screw up IPv6 servers
			return defer.succeed('0.0.0.0')
		if abstract.isIPAddress(name):
			return defer.succeed(name)
		return self.resolver.getHostByName(name, timeout)
Exemplo n.º 2
0
    def resolve(self, name, timeout=(1, 3, 11, 45)):
        """Return a Deferred that will resolve a hostname.
		"""
        if not name:
            # XXX - This is *less than* '::', and will screw up IPv6 servers
            return defer.succeed("0.0.0.0")
        if abstract.isIPAddress(name):
            return defer.succeed(name)
        return self.resolver.getHostByName(name, timeout)
Exemplo n.º 3
0
	def connect(self, host, port):
		"""
		'Connect' to remote server.
		"""
		if self._connectedAddr:
			raise RuntimeError, "already connected, reconnecting is not currently supported (talk to itamar if you want this)"
		if not abstract.isIPAddress(host):
			raise ValueError, "please pass only IP addresses, not domain names"
		self._connectedAddr = (host, port)
		self.socket.connect((host, port))
Exemplo n.º 4
0
    def connect(self, host, port):
        """
		'Connect' to remote server.
		"""
        if self._connectedAddr:
            raise RuntimeError, "already connected, reconnecting is not currently supported (talk to itamar if you want this)"
        if not abstract.isIPAddress(host):
            raise ValueError, "please pass only IP addresses, not domain names"
        self._connectedAddr = (host, port)
        self.socket.connect((host, port))
Exemplo n.º 5
0
	def resolveAddress(self):
		if isIPAddress(self.addr[0]):
			self._setRealAddress(self.addr[0])
		else:
			d = self.reactor.resolve(self.addr[0])
			d.addCallbacks(self._setRealAddress, self.failIfNotConnected)
Exemplo n.º 6
0
 def resolveAddress(self):
     if isIPAddress(self.addr[0]):
         self._setRealAddress(self.addr[0])
     else:
         d = self.reactor.resolve(self.addr[0])
         d.addCallbacks(self._setRealAddress, self.failIfNotConnected)