本文整理汇总了C++中Endpoint::getServices方法的典型用法代码示例。如果您正苦于以下问题:C++ Endpoint::getServices方法的具体用法?C++ Endpoint::getServices怎么用?C++ Endpoint::getServices使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Endpoint
的用法示例。
在下文中一共展示了Endpoint::getServices方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetAdjustedTime
ostream& operator<<(ostream& os, const Peer& p) {
/// when NTP implemented, change to just nTime = GetAdjustedTime()
int64_t nTime = (p._inbound ? GetAdjustedTime() : UnixTime::s());
// Endpoint remote = _socket.remote_endpoint();
Endpoint local = p._socket.local_endpoint();
Endpoint addrYou = (p._proxy ? Endpoint("0.0.0.0") : p.addr);
Endpoint addrMe = (p._proxy ? Endpoint("0.0.0.0") : local);
// hack to avoid serializing the time
if (p._version)
os << const_binary<int>(p._version);
else // not initialized - we assume we are sending the version info
os << const_binary<int>(p._chain.protocol_version());
os << const_binary<uint64_t>(NODE_NETWORK) << const_binary<int64_t>(nTime);
os << const_binary<uint64_t>(addrYou.getServices()) << const_binary<boost::asio::ip::address_v6::bytes_type>(addrYou.getIPv6()) << const_binary<unsigned short>(htons(addrYou.port()));
os << const_binary<uint64_t>(addrMe.getServices()) << const_binary<boost::asio::ip::address_v6::bytes_type>(addrMe.getIPv6()) << const_binary<unsigned short>(htons(addrMe.port()));
os << const_binary<uint64_t>(p._nonce) << const_varstr(p._sub_version);
os << const_binary<int>(p._peerManager.getBestHeight());
os << const_binary<bool>(true);
return os;
}