资源简介
通讯服务器,带Socket功能,操作串口功能,操作数据库功能
代码片段和文件信息
// Comm.cpp: implementation of the CComm class.
//
//////////////////////////////////////////////////////////////////////
#include “stdafx.h“
#include “Comm.h“
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CComm::CComm()
{
// m_hwtRealCtrl = INVALID_HANDLE_VALUE;
m_pRecvPacketHead = NULL;
m_pRecvPacketHead = new PACKETHEAD;
ASSERT(m_pRecvPacketHead != NULL);
m_pSendPacketHead = NULL;
m_pSendPacketHead = new PACKETHEAD;
ASSERT(m_pSendPacketHead != NULL);
m_lpClientListHead = NULL;
m_lpClientListTail = NULL;
m_lpWsListHead = NULL;
m_lpWsListTail = NULL;
InitializeCriticalSection(&m_csClientlink);
InitializeCriticalSection(&m_csWslink);
}
CComm::~CComm()
{
if ( NULL != m_lpClientListHead )
{
PCONN_linkLIST pTempListNode;
while ( NULL != m_lpClientListHead )
{
pTempListNode = m_lpClientListHead;
m_lpClientListHead = m_lpClientListHead->pNext;
delete pTempListNode;
}
}
if ( NULL != m_lpWsListHead )
{
PCONN_linkLIST pTempListNode;
while ( NULL != m_lpWsListHead )
{
pTempListNode = m_lpWsListHead;
m_lpWsListHead = m_lpWsListHead->pNext;
delete pTempListNode;
}
}
delete m_pRecvPacketHead;
delete m_pSendPacketHead;
DeleteCriticalSection(&m_csClientlink);
DeleteCriticalSection(&m_csWslink);
}
BOOL CComm::DataProcess(PPER_IO_CONTEXT pNode)
{
if( NULL == pNode )
return FALSE;
if( NULL == m_pRecvPacketHead )
return FALSE;
if( NULL == m_pSendPacketHead )
return FALSE;
memset(m_pRecvPacketHead 0 sizeof(PACKETHEAD));
memset(m_pSendPacketHead 0 sizeof(PACKETHEAD));
memcpy(m_pRecvPacketHead pNode->wsaBuffer.buf sizeof(PACKETHEAD));
switch(m_pRecvPacketHead->byCmd)
{
case 1:
ClientLogonOn(pNode);
break;
case 2:
ClientLogonOff(pNode);
break;
case 3:
WorkStationLogonOn(pNode);
break;
case 4:
WorkStationLogonOff(pNode);
break;
case 5:
BrushRecordNotify(pNode);
break;
case 6:
AlarmRecordNotify(pNode);
break;
default:
{
if( pNode->sAimClient )
closesocket( pNode->sAimClient );
if( pNode->sRequestClient )
closesocket( pNode->sRequestClient );
InsertToStandby( pNode );
}
break;
}
return TRUE;
}
BOOL CComm::ClientLogonOn(PPER_IO_CONTEXT pNode)
{
m_pSendPacketHead->byDir = 0;
m_pSendPacketHead->byCmd = 1;
m_pSendPacketHead->byStructCount = 1;
m_pSendPacketHead->iTotalPack = 1;
m_pSendPacketHead->iIndexPack = 1;
PPER_IO_CONTEXT pTempNode = NULL;
pTempNode = GetIoFromStandby();
pTempNode->sAimClient = pNode->sAimClient;
CopyMemory( pTempNode->szBuffer m_pSendPacketHead sizeof(PACKETHEAD) );
BOOL bExist = FALSE;
in_addr iaAddr;
int iUserNum = 0;
SOCKET sTemp;
Get
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 173056 2005-05-16 17:09 dataserver\.#DataServer.ncb.1.1.1.1
文件 353792 2005-05-16 17:09 dataserver\.#DataServer.opt.1.1.1.1
文件 11728 2005-05-16 09:47 dataserver\Control\.#Comm.cpp.1.1.1.1
文件 14524 2005-05-16 09:56 dataserver\Control\.#DGSSocket.lib.1.1.1.1
文件 18143 2005-06-08 11:35 dataserver\Control\Comm.cpp
文件 2067 2005-05-27 14:34 dataserver\Control\Comm.h
文件 17960 2005-05-16 09:34 dataserver\Control\Control.aps
文件 156 2005-05-16 09:34 dataserver\Control\Control.clw
文件 1540 2005-05-16 09:34 dataserver\Control\Control.cpp
文件 187 2005-05-16 09:34 dataserver\Control\Control.def
文件 4580 2005-05-16 09:34 dataserver\Control\Control.dsp
文件 1616 2005-05-16 09:34 dataserver\Control\Control.plg
文件 3071 2005-05-16 09:34 dataserver\Control\Control.rc
文件 778 2005-05-27 14:34 dataserver\Control\CVS\Entries
文件 20 2005-05-16 09:33 dataserver\Control\CVS\Repository
文件 36 2005-05-16 09:33 dataserver\Control\CVS\Root
..A.SH. 9 2007-01-13 11:54 dataserver\Control\CVS\_desktop.ini
文件 1739 2005-05-16 09:34 dataserver\Control\DataStruct.h
文件 14524 2011-07-14 16:19 dataserver\Control\DGSSocket.lib
文件 25844 2005-05-16 09:34 dataserver\Control\MSDBE.lib
文件 2493 2005-05-16 09:34 dataserver\Control\ReadMe.txt
文件 399 2005-05-16 09:34 dataserver\Control\res\Control.rc2
文件 52 2005-05-16 09:33 dataserver\Control\res\CVS\Entries
文件 24 2005-05-16 09:33 dataserver\Control\res\CVS\Repository
文件 36 2005-05-16 09:33 dataserver\Control\res\CVS\Root
..A.SH. 9 2007-01-13 11:54 dataserver\Control\res\CVS\_desktop.ini
..A.SH. 9 2007-01-13 11:54 dataserver\Control\res\_desktop.ini
文件 379 2005-05-16 09:34 dataserver\Control\Resource.h
文件 209 2005-05-16 09:34 dataserver\Control\StdAfx.cpp
文件 1449 2005-05-16 09:34 dataserver\Control\StdAfx.h
............此处省略155个文件信息
评论
共有 条评论