NetAddress¶
from acron.net import NetAddress
- class NetAddress¶
Bases:
Represents a network address to which UDP packets may be sent or to which a TCP socket may be bound.
Inheritance diagram
digraph inheritance349d5b23ac { bgcolor=transparent; rankdir=BT; size="8.0, 12.0"; "DTOOL_SUPER_BASE" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style=""]; "NetAddress" [URL="acron.net.NetAddress.html#acron.net.NetAddress",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "DTOOL_SUPER_BASE" -> "NetAddress" [arrowsize=0.75,style=""]; }- __eq__()¶
- __init__()¶
Constructs an unspecified address.
Constructs an address from a given
Socket_Address. Normally, this constructor should not be used by user code; instead, create a defaultNetAddressand use one of the set_*() functions to set up an address.
- __ne__()¶
- clear()¶
Resets the
NetAddressto its initial state.
- get_addr()¶
Returns the
Socket_Addressfor this address.
- get_hash()¶
- get_ip()¶
Returns the IP address to which this address refers, as a 32-bit integer, in host byte order.
Deprecated: Does not work with IPv6 addresses.
- get_ip_component()¶
Returns the nth 8-bit component of the IP address. An IP address has four components; component 0 is the first (leftmost), and component 3 is the last (rightmost) in the dotted number convention.
- get_ip_string()¶
Returns the IP address to which this address refers, formatted as a string.
- get_port()¶
Returns the port number to which this address refers.
- is_any()¶
Returns true if the IP address has only zeroes.
- output()¶
- set_any()¶
Sets the address up to refer to a particular port, but not to any particular IP. Returns true if successful, false otherwise (currently, this only returns true).
- set_broadcast()¶
Sets the address to the broadcast address.
- set_host()¶
Sets the address up to refer to a particular port on a particular host. Returns true if the hostname is known, false otherwise.
- set_localhost()¶
Sets the address up to refer to a particular port, on this host.
- set_port()¶
Resets the port number without otherwise changing the address.