1 enumeration
The maximum address length, which is analogous to the definition in poco::net::ipaddress, but it refers to ' struct SOCKADDR_IN6
Enum
{
max_address_length =
#if defined (Poco_have_ipv6)
sizeof (struct sockaddr_in6)
#else
sizeof (struct sockaddr_in)
#endif
///Maximum length in bytes of the a socket address.
};
2 constructors
Create a wildcard full 0 IPv4 socket address:
SocketAddress ();
Create IPV4 or IPv6 socketaddress with poco::net::ipaddress and port numbers:
SocketAddress (const ipaddress& host, poco::uint16 Port);
Create IPV4 or IPv6 socketaddress with std::string and port numbers:
SocketAddress (const std::string& host, poco::uint16 Port);
SocketAddress (const std::string& Host, const std::string& port);
Explicit socketaddress (const std::string& hostandport);
Copy constructor:
SocketAddress (const socketaddress& addr);
Native form structure socketaddress:
socketaddress (const struct sockaddr* addr, poco_socklen_t length);
3 Common functions
Swap
void swap (socketaddress& addr);
Get IPAddress, port, and address types:
IPAddress host () const;
Poco::uint16 port () const;
Ipaddress::family Family () const;
Gets the address length, address, and address family of the native way:
poco_socklen_t length () const;
const struct SOCKADDR* addr () const;
int af () const;
Tostring:
std::string toString () const;
4 Overloaded operators
BOOL operator = = (Const socketaddress& addr) const;
BOOL operator!= (const socketaddress& addr) const;
5 protected function
void init (const ipaddress& host, poco::uint16 Port);
void init (const std::string& host, poco::uint16 Port);
Poco::uint16 Resolveservice (const std::string& service);
Reprint please indicate the CSDN blog from Liuda: blog.csdn.net/poechant
View a full set of articles: Http://www.bianceng.cn/Programming/cplus/201301/35022.htm