Home | Trees | Indices | Help |
---|
|
object --+ | NetworkAddress
NetworkAddress(addr, port=0, family=PR_AF_INET) :Parameters: addr : string or integer may be an int or a string. port : integer port number family : integer one of: - PR_AF_INET - PR_AF_INET6 If addr argument is a string it may be either a numeric address or a DNS host name and is passed to the `AddrInfo` constructor along with the family parameter. The first address in the `AddrInfo` object is selected. If you need more fine grained control over which address is selected from the `AddrInfo` object then invoke `AddrInfo` and select one of the `NetworkAddress` it provides. If the addr argument is an integer it may be one of the following constants: PR_IpAddrNull Do not set the IP address, only set the port. NetworkAddress(PR_IpAddrNull, 123) is equivalent to NetworkAddress(port=123) PR_IpAddrAny Assign logical PR_INADDR_ANY to IP address. This wildcard value is typically used to establish a socket on which to listen for incoming connection requests. PR_IpAddrLoopback Assign logical PR_INADDR_LOOPBACK. A client can use this value to connect to itself without knowing the host's network address. PR_IpAddrV4Mapped Use IPv4 mapped address The optional port argument sets the port number in the NetworkAddress object. The port number may be modfied later by assigning to the port attribute. Example:: netaddr = nss.io.NetworkAddress('www.python.org') print '%s %s' % (netaddr, netaddr.hostname) netaddr = nss.io.NetworkAddress('82.94.237.218') print '%s %s' % (netaddr, netaddr.hostname) Output: 82.94.237.218:0 www.python.org 82.94.237.218:0 dinsdale.python.org **WARNING:** NetworkAddress initialization from a string only works with IPv4 and its use should be considered *deprecated*. Use `AddrInfo` instead.
|
|||
|
|||
a new object with type S, a subtype of T |
|
||
|
|||
|
|||
Inherited from |
|
|||
address address as string |
|||
family address family (e.g. |
|||
hostentry HostEntry object representing this NetworkAddress (Warning: Deprecated, use AddrInfo instead) |
|||
hostname If an address string was used to construct this NetworkAddress then return the canonical hostname if available, otherwise the original address string |
|||
port network address port |
|||
Inherited from |
|
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
|
|
str(x)
|
:Parameters: addr : string the address string to convert family : integer one of: - PR_AF_INET - PR_AF_INET6 - PR_AF_UNSPEC Reinitializes the NetworkAddress object given a string. Identical to constructing nss.io.NetworkAddress() with a string value (see `NetworkAddress` constructor for documentation). **WARNING:** NetworkAddress initialization from a string only works with IPv4 and its use should be considered *deprecated*. Use `AddrInfo` instead. |
|
familyaddress family (e.g. PR_AF_INET, etc.) |
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Thu Aug 4 17:36:09 2011 | http://epydoc.sourceforge.net |