| Home | Trees | Indices | Help |
|---|
|
|
object --+
|
HostEntry
HostEntry(addr)
: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.
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.
|
|||
|
|||
|
|||
|
|||
a new object with type S, a subtype of T |
|
||
|
|||
|
|||
|
|||
|
Inherited from |
|||
|
|||
|
aliases tuple of aliases for host |
|||
|
family address family (e.g. |
|||
|
hostname official name of host |
|||
|
Inherited from |
|||
|
|||
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
|
|
str(x)
|
:Parameters:
port : integer
optional port value specifying the port to associate with the NetworkAddress.
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.
|
Return a tuple of all possible network address associated with this HostEntry. Each item in the returned tuple is a NetworkAddress object. |
|
|||
familyaddress family (e.g. PR_AF_INET, etc.) |
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Sat Oct 27 13:05:34 2012 | http://epydoc.sourceforge.net |