本文整理汇总了C++中IPAddress::scope方法的典型用法代码示例。如果您正苦于以下问题:C++ IPAddress::scope方法的具体用法?C++ IPAddress::scope怎么用?C++ IPAddress::scope使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPAddress
的用法示例。
在下文中一共展示了IPAddress::scope方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: scope
bool IPAddress::operator < (const IPAddress& a) const
{
poco_socklen_t l1 = length();
poco_socklen_t l2 = a.length();
if (l1 == l2)
{
#if defined(POCO_HAVE_IPv6)
if ( scope() != a.scope() )
return scope() < a.scope();
#endif
return std::memcmp(addr(), a.addr(), l1) < 0;
}
else return l1 < l2;
}
示例2:
IPAddress::IPAddress(const IPAddress& addr)
{
if (addr.family() == IPv4)
newIPv4(addr.addr());
else
newIPv6(addr.addr(), addr.scope());
}
示例3: set
void SocketAddress::set(const IPAddress& host, UInt16 port) {
if (host.family() == IPAddress::IPv6)
_pAddress.reset(new IPv6SocketAddress(host, htons(port), host.scope()));
else
_pAddress.reset(new IPv4SocketAddress(host, htons(port)));
_isNull = host.isWildcard() && port==0;
_toString.clear();
}
示例4: init
void SocketAddress::init(const IPAddress& host, Poco::UInt16 port)
{
if (host.family() == IPAddress::IPv4)
_pImpl = new IPv4SocketAddressImpl(host.addr(), htons(port));
#if defined(POCO_HAVE_IPv6)
else if (host.family() == IPAddress::IPv6)
_pImpl = new IPv6SocketAddressImpl(host.addr(), htons(port), host.scope());
#endif
else throw Poco::NotImplementedException("unsupported IP address family");
}
示例5: htons
SocketAddress::SocketAddress(const IPAddress& host, UInt16 port) {
if (host.family() == IPAddress::IPv6)
_pAddress.reset(new IPv6SocketAddress(host, htons(port), host.scope()));
else
_pAddress.reset(new IPv4SocketAddress(host, htons(port)));
}