ClanSoft logo
ClanSoft logo
Entire Class Index Main Class Index Cross Index Global Index

Class CL_IPAddress

Socket name; container class for an IP address and port.
Contained in: global
Derived from: none
Derived by: none
Group: Network (Sockets)

#include <ClanLib/network.h>


public function member index:

Construction:

CL_IPAddress();
CL_IPAddress(unsigned short port);
CL_IPAddress(void* address);
CL_IPAddress(unsigned int address, unsigned short port);
CL_IPAddress(const std::string& hostname, unsigned short port);
CL_IPAddress(const CL_IPAddress& copy);

Attributes:

unsigned int get_address() const;
unsigned int* get_address6() const;
unsigned short get_port() const;
unsigned char& operator [](int i);
const unsigned char& operator [](int i) const;
bool operator == (const CL_IPAddress& other_instance) const;
bool operator < (const CL_IPAddress& other_instance) const;
bool operator > (const CL_IPAddress& other_instance) const;

Operations:

void set_address(unsigned int new_ip);
void set_address(const std::string& hostname);
void set_port(unsigned short new_port);
std::string dns_lookup() const;
 

Description:


Function Member Descriptions:

CL_IPAddress::CL_IPAddress - Constructs an IP address using INADDR_ANY and port 0.
CL_IPAddress();


CL_IPAddress::CL_IPAddress - Constructs an IP address using INADDR_ANY and the specified port.
CL_IPAddress(unsigned short port);


CL_IPAddress::CL_IPAddress - Constructor for IPv6 address
CL_IPAddress(void* address);


CL_IPAddress::CL_IPAddress - Constructs an IP address using the passed address and port.
CL_IPAddress(unsigned int address, unsigned short port);


CL_IPAddress::CL_IPAddress - Construct an IP address using a hostname.
CL_IPAddress(const std::string& hostname, unsigned short port);


CL_IPAddress::CL_IPAddress - Copy constructor.
CL_IPAddress(const CL_IPAddress& copy);


CL_IPAddress::dns_lookup - Do a DNS lookup on the IP address.
std::string dns_lookup() const;


CL_IPAddress::get_address - Returns the IP address in network byte order.
unsigned int get_address() const;


CL_IPAddress::get_port - Returns the IP port in host byte order.
unsigned short get_port() const;


CL_IPAddress::operator < - Returns true if the other address is less. This is used for sorting purposes (eg. if you use a std::map<CL_IPAddress, CL_Socket>), and sorts the address based on lowest IP number address.
bool operator < (const CL_IPAddress& other_instance) const;


CL_IPAddress::operator == - Returns true if objects are the same.
bool operator == (const CL_IPAddress& other_instance) const;


CL_IPAddress::operator > - Returns true if the other address is greater. This is used for sorting purposes (eg. if you use a std::map<CL_IPAddress, CL_Socket>), and sorts the address based on lowest IP number address.
bool operator > (const CL_IPAddress& other_instance) const;


CL_IPAddress::operator [] - Returns the specified address field.
const unsigned char& operator [](int i) const;


CL_IPAddress::operator [] - Returns the specified address field.
unsigned char& operator [](int i);


CL_IPAddress::set_address - Set the IP address, in network byte order.
void set_address(unsigned int new_ip);


CL_IPAddress::set_address - Set the IP address using a hostname.
void set_address(const std::string& hostname);


CL_IPAddress::set_port - Set the IP port.
void set_port(unsigned short new_port);



Variable Member Descriptions: