interface documentation

An IHostnameResolver can resolve a host name and port number into a series of IAddress objects.

Present Since
Twisted 17.1.0
Method resolveHostName Initiate a hostname resolution.
def resolveHostName(resolutionReceiver: IResolutionReceiver, hostName: str, portNumber: int = 0, addressTypes: Optional[Sequence[Type[IAddress]]] = None, transportSemantics: str = 'TCP') -> IHostResolution: (source)

Initiate a hostname resolution.

Parameters
resolutionReceiver:IResolutionReceiveran object that will receive each resolved address as it arrives.
hostName:strThe name of the host to resolve. If this contains non-ASCII code points, they will be converted to IDNA first.
portNumber:intThe port number that the returned addresses should include.
addressTypes:Optional[Sequence[Type[IAddress]]]An iterable of implementors of IAddress that are acceptable values for resolutionReceiver to receive to its addressResolved. In practice, this means an iterable containing twisted.internet.address.IPv4Address, twisted.internet.address.IPv6Address, both, or neither.
transportSemantics:strA string describing the semantics of the transport; either 'TCP' for stream-oriented transports or 'UDP' for datagram-oriented; see twisted.internet.address.IPv6Address.type and twisted.internet.address.IPv4Address.type.
Returns
IHostResolutionThe resolution in progress.