本文整理汇总了C++中CSocket::Reset方法的典型用法代码示例。如果您正苦于以下问题:C++ CSocket::Reset方法的具体用法?C++ CSocket::Reset怎么用?C++ CSocket::Reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocket
的用法示例。
在下文中一共展示了CSocket::Reset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Accept
EIO_Status CListeningSocket::Accept(CSocket& sock,
const STimeout* timeout,
TSOCK_Flags flags) const
{
SOCK x_sock;
EIO_Status status;
if ( !m_Socket ) {
x_sock = 0;
status = eIO_Closed;
} else
status = LSOCK_AcceptEx(m_Socket, timeout, &x_sock, flags);
assert(!x_sock ^ !(status != eIO_Success));
sock.Reset(x_sock, eTakeOwnership, eCopyTimeoutsToSOCK);
return status;
}
示例2: s_GrabSOCK
static SOCK s_GrabSOCK(CSocket& socket)
{
SOCK sock = socket.GetSOCK();
if (!sock) {
NCBI_THROW(CIO_Exception, eInvalidArg,
"CConn_SocketStream::CConn_SocketStream(): "
" Socket may not be empty");
}
if (socket.SetOwnership(eNoOwnership) == eNoOwnership) {
NCBI_THROW(CIO_Exception, eInvalidArg,
"CConn_SocketStream::CConn_SocketStream(): "
" Socket must be owned");
}
socket.Reset(0/*empty*/,
eNoOwnership/*irrelevant*/,
eCopyTimeoutsFromSOCK/*irrelevant*/);
return sock;
}