本文整理汇总了C++中ACE_SOCK_Stream::get_local_addr方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_SOCK_Stream::get_local_addr方法的具体用法?C++ ACE_SOCK_Stream::get_local_addr怎么用?C++ ACE_SOCK_Stream::get_local_addr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_SOCK_Stream
的用法示例。
在下文中一共展示了ACE_SOCK_Stream::get_local_addr方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: str
template <class HANDLER> void
ACE_Asynch_Acceptor<HANDLER>::parse_address (const
ACE_Asynch_Accept::Result &result,
ACE_INET_Addr &remote_address,
ACE_INET_Addr &local_address)
{
ACE_TRACE ("ACE_Asynch_Acceptor<>::parse_address");
#if defined (ACE_HAS_AIO_CALLS)
// Use an ACE_SOCK to get the addresses - it knows how to deal with
// ACE_INET_Addr objects and get IPv4/v6 addresses.
ACE_SOCK_Stream str (result.accept_handle ());
str.get_local_addr (local_address);
str.get_remote_addr (remote_address);
#elif defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
ACE_Message_Block &message_block = result.message_block ();
sockaddr *local_addr = 0;
sockaddr *remote_addr = 0;
int local_size = 0;
int remote_size = 0;
// This matches setup in accept().
size_t addr_size = sizeof (sockaddr_in) + 16;
#if defined (ACE_HAS_IPV6)
if (this->addr_family_ == PF_INET6)
addr_size = sizeof (sockaddr_in6) + 16;
#endif /* ACE_HAS_IPV6 */
::GetAcceptExSockaddrs (message_block.rd_ptr (),
static_cast<DWORD> (this->bytes_to_read_),
static_cast<DWORD> (addr_size),
static_cast<DWORD> (addr_size),
&local_addr,
&local_size,
&remote_addr,
&remote_size);
local_address.set (reinterpret_cast<sockaddr_in *> (local_addr),
local_size);
remote_address.set (reinterpret_cast<sockaddr_in *> (remote_addr),
remote_size);
#else
// just in case
errno = ENOTSUP;
#endif /* defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) */
return;
}