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.

getAddr() Socket_Address

Returns the Socket_Address for this address.

getHash() int
getIp() 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.

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.

getIpString() str

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

getPort() int

Returns the port number to which this address refers.

isAny() bool

Returns true if the IP address has only zeroes.

output(out: ostream)
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).

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.

setLocalhost(port: int) bool

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

setPort(port: int)

Resets the port number without otherwise changing the address.