• 大小: 284KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-08
  • 语言: 其他
  • 标签: 完成端口  

资源简介

包含了IOCP的客户端,和IOCP服务器,以及心跳机制

资源截图

代码片段和文件信息

#include “StdAfx.h“
#include “ControlTimer.h“
#include 
CControlTimer::CControlTimer(void)
{
InitializeCriticalSection(&m_cs);
m_MapIdevent.clear();
m_hTimer = CreateTimerQueue();
assert(m_hTimer != NULL);
}


CControlTimer::~CControlTimer(void)
{
KillTimer();
DeleteCriticalSection(&m_cs);
if(m_hTimer)
{
DeleteTimerQueueEx(m_hTimerNULL);
}
}

void CControlTimer::SetTimer(UINT nIDEventUINT nElapse WAITORTIMERCALLBACK lpTimerFunc)
{
if(m_hTimer == NULL) return;

EnterCriticalSection(&m_cs);
if(m_MapIdevent.count(nIDEvent) > 0)
{
DeleteTimerQueueTimer(m_hTimerm_MapIdevent[nIDEvent]NULL);
}
HANDLE handle = NULL;
CreateTimerQueueTimer(&handlem_hTimerlpTimerFunc(LPVOID)nIDEventnElapsenElapseWT_EXECUTEDEFAULT);
m_MapIdevent[nIDEvent] = handle;
LeaveCriticalSection(&m_cs);
}
void CControlTimer::KillTimer(UINT nIDEvent )
{
EnterCriticalSection(&m_cs);
if(m_MapIdevent.count(nIDEvent) > 0)
{
DeleteTimerQueueTimer(m_hTimerm_MapIdevent[nIDEvent]NULL);
m_MapIdevent.erase(nIDEvent);
}
LeaveCriticalSection(&m_cs);
}

void CControlTimer::KillTimer()
{
if(m_hTimer == NULL) return;

EnterCriticalSection(&m_cs);
std::map::iterator it = m_MapIdevent.begin();
while(it != m_MapIdevent.end())
{
DeleteTimerQueueTimer(m_hTimerit->secondNULL);
++it;
}
m_MapIdevent.clear();
LeaveCriticalSection(&m_cs);
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1438  2015-05-26 13:41  testSock\iocp\ControlTimer.cpp

     文件        368  2015-05-25 17:36  testSock\iocp\ControlTimer.h

     文件        294  2015-05-25 09:08  testSock\iocp\iocp.cpp

     文件       4804  2015-05-26 14:02  testSock\iocp\iocp.vcxproj

     文件       2252  2015-05-26 14:02  testSock\iocp\iocp.vcxproj.filters

     文件        143  2015-05-22 09:24  testSock\iocp\iocp.vcxproj.user

     文件       3270  2015-05-26 16:59  testSock\iocp\IocpClientModal.cpp

     文件       1023  2015-05-26 16:59  testSock\iocp\IocpClientModal.h

     文件       7276  2015-05-26 17:06  testSock\iocp\IocpModal.cpp

     文件       2255  2015-05-26 16:56  testSock\iocp\IocpModal.h

     文件       1678  2015-05-26 14:56  testSock\iocp\IocpSeverModal.cpp

     文件        262  2015-05-26 14:13  testSock\iocp\IocpSeverModal.h

     文件       1532  2015-05-22 09:24  testSock\iocp\ReadMe.txt

     文件         49  2015-05-22 10:30  testSock\iocp\SafeQue.cpp

     文件       2578  2015-05-22 17:31  testSock\iocp\SafeQue.h

     文件        209  2015-05-22 09:24  testSock\iocp\stdafx.cpp

     文件        233  2015-05-22 09:24  testSock\iocp\stdafx.h

     文件        236  2015-05-22 09:24  testSock\iocp\targetver.h

     文件       1438  2015-05-26 13:41  testSock\testIocpClient\ControlTimer.cpp

     文件        368  2015-05-25 17:36  testSock\testIocpClient\ControlTimer.h

     文件        591  2015-05-26 17:01  testSock\testIocpClient\IocpClient.cpp

     文件        390  2015-05-26 15:45  testSock\testIocpClient\IocpClient.h

     文件       3270  2015-05-26 16:59  testSock\testIocpClient\IocpClientModal.cpp

     文件       1023  2015-05-26 16:59  testSock\testIocpClient\IocpClientModal.h

     文件       7276  2015-05-26 17:07  testSock\testIocpClient\IocpModal.cpp

     文件       2255  2015-05-26 16:58  testSock\testIocpClient\IocpModal.h

     文件       3146  2015-05-26 14:57  testSock\testIocpClient\ReadMe.txt

     文件      67777  2009-08-31 02:31  testSock\testIocpClient\res\testIocpClient.ico

     文件        684  2015-05-26 14:57  testSock\testIocpClient\res\testIocpClient.rc2

     文件       1374  2015-05-26 15:00  testSock\testIocpClient\resource.h

............此处省略46个文件信息

评论

共有 条评论