本文整理汇总了C++中CSocket::WriteEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ CSocket::WriteEvent方法的具体用法?C++ CSocket::WriteEvent怎么用?C++ CSocket::WriteEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocket
的用法示例。
在下文中一共展示了CSocket::WriteEvent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleMessage
int32_t CEpoll::HandleMessage(int32_t nWaitTimeout)
{
if(m_nEpollFD <= 0)
{
Delay(10000);
return -1;
}
int32_t nEventCount = epoll_wait(m_nEpollFD, m_pEpollEvent, m_nMaxFD, nWaitTimeout);
if(nEventCount < 0)
{
return -1;
}
for(int32_t i = 0; i < nEventCount; ++i)
{
CSocket *pSocket = (CSocket *)m_pEpollEvent[i].data.ptr;
if(pSocket == NULL)
{
continue;
}
SessionStatus nSessionStatus = pSocket->GetSessionStatus();
if((nSessionStatus == enmSessionStatus_Closed) || (nSessionStatus == enmSessionStatus_Error))
{
continue;
}
if((m_pEpollEvent[i].events & EPOLLIN) != 0)
{
pSocket->ReadEvent();
SessionStatus nSessionStatus = pSocket->GetSessionStatus();
if((nSessionStatus == enmSessionStatus_Closed) || (nSessionStatus == enmSessionStatus_Error))
{
continue;
}
}
if((m_pEpollEvent[i].events & EPOLLOUT) != 0)
{
pSocket->WriteEvent();
SessionStatus nSessionStatus = pSocket->GetSessionStatus();
if((nSessionStatus == enmSessionStatus_Closed) || (nSessionStatus == enmSessionStatus_Error))
{
continue;
}
}
if((m_pEpollEvent[i].events & EPOLLERR) != 0)
{
pSocket->ErrorEvent();
SessionStatus nSessionStatus = pSocket->GetSessionStatus();
if((nSessionStatus == enmSessionStatus_Closed) || (nSessionStatus == enmSessionStatus_Error))
{
continue;
}
}
if((m_pEpollEvent[i].events & EPOLLHUP) != 0)
{
pSocket->ErrorEvent();
SessionStatus nSessionStatus = pSocket->GetSessionStatus();
if((nSessionStatus == enmSessionStatus_Closed) || (nSessionStatus == enmSessionStatus_Error))
{
continue;
}
}
// if(!(m_pEpollEvent[i].events & EPOLLIN) &&
// !(m_pEpollEvent[i].events & EPOLLOUT) &&
// !(m_pEpollEvent[i].events & EPOLLERR) &&
// !(m_pEpollEvent[i].events & EPOLLHUP))
// {
// g_FrameLogEngine.WriteNetioLog(enmLogLevel_Error, "it's not found ioevent = 0x%08x\n", m_pEpollEvent[i].events);
// }
}
return nEventCount;
}