本文整理汇总了C++中ACE_INET_Addr::is_ip_equal方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_INET_Addr::is_ip_equal方法的具体用法?C++ ACE_INET_Addr::is_ip_equal怎么用?C++ ACE_INET_Addr::is_ip_equal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_INET_Addr
的用法示例。
在下文中一共展示了ACE_INET_Addr::is_ip_equal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
int
Echo_Handler::handle_input (ACE_HANDLE)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) Echo_Handler::handle_input - ")
ACE_TEXT ("activity occurred on handle %d!\n"),
this->ping_socket ().get_handle ()));
ACE_TCHAR buf[BUFSIZ];
ACE_OS::memset (buf, 0, sizeof buf);
ACE_INET_Addr addr;
int rval_recv = -1;
// Receive an <n> byte <buf> from the datagram socket
// (uses<recvfrom(3)>).
rval_recv =
this->ping_socket ().recv (this->ping_socket ().icmp_recv_buff (),
ACE_Ping_Socket::PING_BUFFER_SIZE,
addr);
switch (rval_recv)
{
case -1:
// Complain and leave, but keep registered, returning 0.
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("(%P|%t) Echo_Handler::handle_input - ")
ACE_TEXT ("%p: bad read\n"),
ACE_TEXT ("client")),
0);
// NOTREACHED
case 0:
// Complain and leave
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("(%P|%t) Echo_Handler::handle_input - ")
ACE_TEXT ("closing daemon (fd = %d)\n"),
this->get_handle ()),
0);
// NOTREACHED
default:
ACE_DEBUG ((LM_INFO,
ACE_TEXT ("(%P|%t) Echo_Handler::handle_input - ")
ACE_TEXT ("message from %d bytes received.\n"),
rval_recv));
if (! this->ping_socket ().process_incoming_dgram (
this->ping_socket ().icmp_recv_buff (),
rval_recv))
{
for (size_t k = 0; k <this->number_remotes_; ++k)
{
if (addr.is_ip_equal (this->remote_addrs_[k]))
{
if (addr.addr_to_string (buf, sizeof buf) == -1)
{
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("can't obtain peer's address")));
}
else
{
ACE_DEBUG
((LM_INFO,
ACE_TEXT ("(%P|%t) Echo_Handler::handle_input - ")
ACE_TEXT ("ECHO_REPLY received ")
ACE_TEXT ("from %s; marking this peer alive\n"),
buf));
}
// mark as successful
this->success_status_[k] = 0;
break;
}
}
}
break;
}
return 0;
}