type HostEntry
object --+
|
HostEntry
HostEntry(addr)
A HostEntry contains an official name of the host, a set of aliases
for the host name, an address family and a set of network addresses (all
within the single address family).
After successful initialization the HostEntry object will contain
an unordered sequence of NetworkAddress objects which may be
accessed via iteration or indexing. It is suggested you try connecting
with the each NetworkAddress object in sequential order until
one succeeds.
Example Usage:
host_entry = io.HostEntry(hostname)
for net_addr in host_entry:
net_addr.port = port
sock = io.Socket(net_addr.family)
try:
sock.connect(net_addr, timeout=io.seconds_to_interval(1))
break
except Exception, e:
pass
WARNING: HostEntry only supports IPv4 lookups and it's address
list is unordered, HostEntry should be considered deprecated. Use
AddrInfo instead.
|
|
|
__init__(addr)
x.__init__(...) initializes x; see help(type(x)) for signature |
|
|
|
|
a new object with type S, a subtype of T
|
|
|
|
|
get_network_address(port=0)
Returns the first network address associated with this HostEntry as a
NetworkAddress object. |
|
|
|
get_network_addresses(port=0)
Return a tuple of all possible network address associated with this
HostEntry. |
|
|
|
aliases
tuple of aliases for host
|
|
family
address family (e.g.
|
|
hostname
official name of host
|
__init__(addr)
(Constructor)
|
|
x.__init__(...) initializes x; see help(type(x)) for signature
- Parameters:
addr (string or NetworkAddr object) -
- May be either a string or a NetworkAddr object.
- If addr is string it is equivalent to GetHostByName.
- If addr is a NetworkAddress object it is equivalent to GetHostByAddr.
- Overrides:
object.__init__
|
- Returns: a new object with type S, a subtype of T
- Overrides:
object.__new__
|
__str__(x)
(Informal representation operator)
|
|
str(x)
- Overrides:
object.__str__
|
get_network_address(port=0)
|
|
Returns the first network address associated with this HostEntry as a
NetworkAddress object. Equivalent to get_network_addresses()[0]. Note,
may return None if the HostEntry does not have address associated with
it.
- Parameters:
port (integer) - optional port value specifying the port to associate with the NetworkAddress.
|
get_network_addresses(port=0)
|
|
Return a tuple of all possible network address associated with this
HostEntry. Each item in the returned tuple is a NetworkAddress object.
|
family
address family (e.g. PR_AF_INET, etc.)
|