panda3d.core.NetAddress

from panda3d.core import NetAddress
class NetAddress

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

__init__() → None

Constructs an unspecified address.

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

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.

setAny(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).

setLocalhost(port: int) → bool

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

setBroadcast(port: int) → bool

Sets the address to the broadcast address.

setHost(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.

clear() → None

Resets the NetAddress to its initial state.

getPort() → int

Returns the port number to which this address refers.

setPort(port: int) → None

Resets the port number without otherwise changing the address.

getIpString() → str

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

isAny() → bool

Returns true if the IP address has only zeroes.

getIp() → uint32_t

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.

Return type

uint32_t

getIpComponent(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.

Return type

uint8_t

getAddr() → Socket_Address

Returns the Socket_Address for this address.

Return type

Socket_Address

output(out: ostream) → None
getHash() → size_t
Return type

size_t