1 enumeration
The maximum address length, which Poco::Net::IPAddress
is analogous to the definition in, but refers to the ' 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 a socket address.};
2 constructors
Create a wildcard full 0 IPv4 socket address:
SocketAddress();
Create a socketaddress of IPv4 or IPv6 with poco::net::ipaddress and port numbers:
SocketAddress(const IPAddress& host, Poco::UInt16 port);
Create a socketaddress of IPv4 or IPv6 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 Mode construction socketaddress:
SocketAddress(const struct sockaddr* addr, poco_socklen_t length);
3 Common functions
Swap
Get IPAddress, ports, 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 mode:
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);
-
From:blog.csdn.net/poechant
Poco Library Chinese Programming Reference Guide (5) poco::net::socketaddress