NetAddress

from panda3d.core 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

Inheritance diagram of NetAddress

__eq__(other: NetAddress) bool
__init__()

Constructs an unspecified address.

__init__(param0: NetAddress)
__init__(addr: Socket_Address)

Constructs an address from a given Socket_Address. Normally, this constructor should not be used by user code; instead, create a default NetAddress and use one of the set_*() functions to set up an address.

__ne__(other: NetAddress) bool
clear()

Resets the NetAddress to its initial state.

get_addr() Socket_Address

Returns the Socket_Address for this address.

get_hash() int
get_ip() int

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(n: int) uint8_t

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() str

Returns the IP address to which this address refers, formatted as a string.

get_port() int

Returns the port number to which this address refers.

is_any() bool

Returns true if the IP address has only zeroes.

output(out: ostream)
set_any(port: int) bool

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(port: int) bool

Sets the address to the broadcast address.

set_host(hostname: str, port: int) bool

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(port: int) bool

Sets the address up to refer to a particular port, on this host.

set_port(port: int)

Resets the port number without otherwise changing the address.