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

A simple place to store and manipulate tcp and port address for communication layer. More...

Public Member Functions

 __init__ (const SocketAddress inaddr)
 
 __init__ (unsigned short int port)
 Constructor that lets us set a port value. More...
 
 clear ()
 Set the internal values to a suitable known value. More...
 
sa_family_t getFamily ()
 Returns AF_INET if this is an IPv4 address, or AF_INET6 if this is an IPv6 address. More...
 
str getIp ()
 Return the IP address portion in dot notation string. More...
 
unsigned long int GetIPAddressRaw ()
 Returns a raw 32-bit unsigned integer representing the IPv4 address. More...
 
str getIpPort ()
 Return the ip address/port in dot notation string. More...
 
unsigned short int getPort ()
 Get the port portion as an integer. More...
 
bool isAny ()
 True if the address is zero. More...
 
bool isMcastRange ()
 True if the address is in the multicast range. More...
 
bool operator != (const SocketAddress in)
 
bool operator< (const SocketAddress in)
 
bool operator== (const SocketAddress in)
 
bool setAnyIP (unsigned short int port)
 Set to any address and a specified port. More...
 
bool setAnyIPv6 (unsigned short int port)
 Set to any IPv6 address and a specified port. More...
 
bool setBroadcast (unsigned short int port)
 Set to the broadcast address and a specified port. More...
 
bool setHost (str hostname)
 Initializes the address from a string specifying both the address and port, separated by a colon. More...
 
bool setHost (str hostname, unsigned short int port)
 This function will take a port and string-based TCP address and initialize the address with this information. More...
 
bool setHost (uint32_t ip4addr, unsigned short int port)
 
bool setPort (unsigned short int port)
 Set to a specified port. More...
 

Detailed Description

A simple place to store and manipulate tcp and port address for communication layer.

Member Function Documentation

◆ __init__() [1/2]

__init__ ( const SocketAddress  inaddr)

◆ __init__() [2/2]

__init__ ( unsigned short int  port)

Constructor that lets us set a port value.

◆ clear()

clear ( )

Set the internal values to a suitable known value.

◆ getFamily()

sa_family_t getFamily ( )

Returns AF_INET if this is an IPv4 address, or AF_INET6 if this is an IPv6 address.

◆ getIp()

str getIp ( )

Return the IP address portion in dot notation string.

◆ GetIPAddressRaw()

unsigned long int GetIPAddressRaw ( )

Returns a raw 32-bit unsigned integer representing the IPv4 address.

◆ getIpPort()

str getIpPort ( )

Return the ip address/port in dot notation string.

If this is an IPv6 address, it will be enclosed in square brackets.

◆ getPort()

unsigned short int getPort ( )

Get the port portion as an integer.

◆ isAny()

bool isAny ( )

True if the address is zero.

◆ isMcastRange()

bool isMcastRange ( )

True if the address is in the multicast range.

◆ operator !=()

bool operator != ( const SocketAddress  in)

◆ operator<()

bool operator< ( const SocketAddress  in)

◆ operator==()

bool operator== ( const SocketAddress  in)

◆ setAnyIP()

bool setAnyIP ( unsigned short int  port)

Set to any address and a specified port.

◆ setAnyIPv6()

bool setAnyIPv6 ( unsigned short int  port)

Set to any IPv6 address and a specified port.

◆ setBroadcast()

bool setBroadcast ( unsigned short int  port)

Set to the broadcast address and a specified port.

◆ setHost() [1/3]

bool setHost ( str  hostname)

Initializes the address from a string specifying both the address and port, separated by a colon.

An IPv6 address must be enclosed in brackets.

◆ setHost() [2/3]

bool setHost ( str  hostname,
unsigned short int  port 
)

This function will take a port and string-based TCP address and initialize the address with this information.

Returns true on success; on failure, it returns false and the address may be undefined.

◆ setHost() [3/3]

bool setHost ( uint32_t  ip4addr,
unsigned short int  port 
)

◆ setPort()

bool setPort ( unsigned short int  port)

Set to a specified port.