本文整理汇总了C++中HostAddress::port方法的典型用法代码示例。如果您正苦于以下问题:C++ HostAddress::port方法的具体用法?C++ HostAddress::port怎么用?C++ HostAddress::port使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HostAddress
的用法示例。
在下文中一共展示了HostAddress::port方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
bool RedisProxy::run(const HostAddress& addr)
{
if (isRunning()) {
return false;
}
if (m_vipEnabled) {
TcpSocket sock = TcpSocket::createTcpSocket();
Logger::log(Logger::Message, "connect to vip address(%s:%d)...", m_vipAddress, addr.port());
if (!sock.connect(HostAddress(m_vipAddress, addr.port()))) {
Logger::log(Logger::Message, "set VIP [%s,%s]...", m_vipName, m_vipAddress);
int ret = NonPortable::setVipAddress(m_vipName, m_vipAddress, 0);
Logger::log(Logger::Message, "set_vip_address return %d", ret);
} else {
m_vipSocket = sock;
m_vipEvent.set(eventLoop(), sock.socket(), EV_READ, vipHandler, this);
m_vipEvent.active();
}
}
m_monitor->proxyStarted(this);
Logger::log(Logger::Message, "Start the %s on port %d", APP_NAME, addr.port());
RedisCommand cmds[] = {
{"HASHMAPPING", 11, -1, onHashMapping, NULL},
{"ADDKEYMAPPING", 13, -1, onAddKeyMapping, NULL},
{"DELKEYMAPPING", 13, -1, onDelKeyMapping, NULL},
{"SHOWMAPPING", 11, -1, onShowMapping, NULL},
{"POOLINFO", 8, -1, onPoolInfo, NULL},
{"SHUTDOWN", 8, -1, onShutDown, this}
};
RedisCommandTable::instance()->registerCommand(cmds, sizeof(cmds)/sizeof(RedisCommand));
return TcpServer::run(addr);
}
示例2: return
bool HostAddress::operator==(const HostAddress& other) const {
return (other.ip() == ip() && other.port() == port());
}