Panda3D
Public Member Functions | List of all members
NetAddress Class Reference

Public Member Functions

 __init__ ()
 Constructs an unspecified address. More...
 
 __init__ (const SocketAddress addr)
 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. More...
 
 clear ()
 Resets the NetAddress to its initial state. More...
 
const SocketAddress getAddr ()
 Returns the Socket_Address for this address. More...
 
size_t getHash ()
 
PNUint32 getIp ()
 Returns the IP address to which this address refers, as a 32-bit integer, in host byte order. More...
 
PNUint8 getIpComponent (int n)
 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. More...
 
str getIpString ()
 Returns the IP address to which this address refers, formatted as a string. More...
 
int getPort ()
 Returns the port number to which this address refers. More...
 
bool operator!= (const NetAddress other)
 
bool operator== (const NetAddress other)
 
 output (Ostream out)
 
bool setAny (int port)
 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). More...
 
bool setBroadcast (int port)
 Sets the address to the broadcast address. More...
 
bool setHost (str hostname, int port)
 Sets the address up to refer to a particular port on a particular host. Returns true if the hostname is known, false otherwise. More...
 
bool setLocalhost (int port)
 Sets the address up to refer to a particular port, on this host. More...
 
 setPort (int port)
 Resets the port number without otherwise changing the address. More...
 

Member Function Documentation

◆ __init__() [1/2]

__init__ ( )

Constructs an unspecified address.

◆ __init__() [2/2]

__init__ ( const SocketAddress  addr)

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.

◆ clear()

clear ( )

Resets the NetAddress to its initial state.

◆ getAddr()

const SocketAddress getAddr ( )

Returns the Socket_Address for this address.

◆ getHash()

size_t getHash ( )

◆ getIp()

PNUint32 getIp ( )

Returns the IP address to which this address refers, as a 32-bit integer, in host byte order.

◆ getIpComponent()

PNUint8 getIpComponent ( int  n)

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

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

◆ getPort()

int getPort ( )

Returns the port number to which this address refers.

◆ operator!=()

bool operator!= ( const NetAddress  other)

◆ operator==()

bool operator== ( const NetAddress  other)

◆ output()

output ( Ostream  out)

◆ setAny()

bool setAny ( int  port)

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

bool setBroadcast ( int  port)

Sets the address to the broadcast address.

◆ setHost()

bool setHost ( str  hostname,
int  port 
)

Sets the address up to refer to a particular port on a particular host. Returns true if the hostname is known, false otherwise.

◆ setLocalhost()

bool setLocalhost ( int  port)

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

◆ setPort()

setPort ( int  port)

Resets the port number without otherwise changing the address.