|
@@ -724,7 +724,7 @@ void CSATTCPServer::_RecvProcess(PER_SOCKET_CONTEXT* pSocketContext, PER_IO_CONT
|
|
#ifdef _DEBUG
|
|
#ifdef _DEBUG
|
|
OutputDebugString("有数据返回\n");
|
|
OutputDebugString("有数据返回\n");
|
|
#endif
|
|
#endif
|
|
- GLOBAL::WriteTextLog("有数据返回");
|
|
|
|
|
|
+ //GLOBAL::WriteTextLog("有数据返回");
|
|
// 小于包头;
|
|
// 小于包头;
|
|
SATPROTO::DataHeader* phead = NULL;
|
|
SATPROTO::DataHeader* phead = NULL;
|
|
if (pSocketContext->lastData.size() == 0)
|
|
if (pSocketContext->lastData.size() == 0)
|
|
@@ -733,7 +733,7 @@ void CSATTCPServer::_RecvProcess(PER_SOCKET_CONTEXT* pSocketContext, PER_IO_CONT
|
|
if (PAK_LEN > pIoContext->m_Overlapped.InternalHigh)
|
|
if (PAK_LEN > pIoContext->m_Overlapped.InternalHigh)
|
|
{
|
|
{
|
|
OutputDebugString("A:不足包头;\n");
|
|
OutputDebugString("A:不足包头;\n");
|
|
- GLOBAL::WriteTextLog("A:不足包头");
|
|
|
|
|
|
+ //GLOBAL::WriteTextLog("A:不足包头");
|
|
pSocketContext->lastData.append(pIoContext->m_wsaBuf.buf, pIoContext->m_Overlapped.InternalHigh);
|
|
pSocketContext->lastData.append(pIoContext->m_wsaBuf.buf, pIoContext->m_Overlapped.InternalHigh);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
@@ -743,7 +743,7 @@ void CSATTCPServer::_RecvProcess(PER_SOCKET_CONTEXT* pSocketContext, PER_IO_CONT
|
|
if ( !CheckDataHeader(phead) )
|
|
if ( !CheckDataHeader(phead) )
|
|
{
|
|
{
|
|
OutputDebugString("A:包头损坏;\n");
|
|
OutputDebugString("A:包头损坏;\n");
|
|
- GLOBAL::WriteTextLog("A:包头损坏");
|
|
|
|
|
|
+ //GLOBAL::WriteTextLog("A:包头损坏");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -751,21 +751,21 @@ void CSATTCPServer::_RecvProcess(PER_SOCKET_CONTEXT* pSocketContext, PER_IO_CONT
|
|
if (phead->len == pIoContext->m_Overlapped.InternalHigh)
|
|
if (phead->len == pIoContext->m_Overlapped.InternalHigh)
|
|
{
|
|
{
|
|
OutputDebugString("A:完整的包;\n");
|
|
OutputDebugString("A:完整的包;\n");
|
|
- GLOBAL::WriteTextLog("A:完整的包");
|
|
|
|
|
|
+ //GLOBAL::WriteTextLog("A:完整的包");
|
|
_TaskProcess(pIoContext, (SATPROTO::Package*)pIoContext->m_wsaBuf.buf);
|
|
_TaskProcess(pIoContext, (SATPROTO::Package*)pIoContext->m_wsaBuf.buf);
|
|
}
|
|
}
|
|
// 小包;
|
|
// 小包;
|
|
else if (phead->len > pIoContext->m_Overlapped.InternalHigh)
|
|
else if (phead->len > pIoContext->m_Overlapped.InternalHigh)
|
|
{
|
|
{
|
|
OutputDebugString("A:小包;\n");
|
|
OutputDebugString("A:小包;\n");
|
|
- GLOBAL::WriteTextLog("A:小包");
|
|
|
|
|
|
+ //GLOBAL::WriteTextLog("A:小包");
|
|
pSocketContext->lastData.append(pIoContext->m_wsaBuf.buf, pIoContext->m_Overlapped.InternalHigh);
|
|
pSocketContext->lastData.append(pIoContext->m_wsaBuf.buf, pIoContext->m_Overlapped.InternalHigh);
|
|
}
|
|
}
|
|
// 超包;
|
|
// 超包;
|
|
else if (phead->len < pIoContext->m_Overlapped.InternalHigh)
|
|
else if (phead->len < pIoContext->m_Overlapped.InternalHigh)
|
|
{
|
|
{
|
|
OutputDebugString("A:超包;\n");
|
|
OutputDebugString("A:超包;\n");
|
|
- GLOBAL::WriteTextLog("A:超包");
|
|
|
|
|
|
+ //GLOBAL::WriteTextLog("A:超包");
|
|
pSocketContext->lastData.append(pIoContext->m_wsaBuf.buf + phead->len, pIoContext->m_Overlapped.InternalHigh - phead->len);
|
|
pSocketContext->lastData.append(pIoContext->m_wsaBuf.buf + phead->len, pIoContext->m_Overlapped.InternalHigh - phead->len);
|
|
_TaskProcess(pIoContext, (SATPROTO::Package*)pIoContext->m_wsaBuf.buf);
|
|
_TaskProcess(pIoContext, (SATPROTO::Package*)pIoContext->m_wsaBuf.buf);
|
|
}
|
|
}
|
|
@@ -780,7 +780,7 @@ void CSATTCPServer::_RecvProcess(PER_SOCKET_CONTEXT* pSocketContext, PER_IO_CONT
|
|
if ( !CheckDataHeader(phead) )
|
|
if ( !CheckDataHeader(phead) )
|
|
{
|
|
{
|
|
OutputDebugString("C:包头损坏;\n");
|
|
OutputDebugString("C:包头损坏;\n");
|
|
- GLOBAL::WriteTextLog("C:包头损坏");
|
|
|
|
|
|
+ //GLOBAL::WriteTextLog("C:包头损坏");
|
|
pSocketContext->lastData.clear();
|
|
pSocketContext->lastData.clear();
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -790,7 +790,7 @@ void CSATTCPServer::_RecvProcess(PER_SOCKET_CONTEXT* pSocketContext, PER_IO_CONT
|
|
if ( phead->len <= pSocketContext->lastData.size() )
|
|
if ( phead->len <= pSocketContext->lastData.size() )
|
|
{
|
|
{
|
|
OutputDebugString("C:超包;\n");
|
|
OutputDebugString("C:超包;\n");
|
|
- GLOBAL::WriteTextLog("C:超包");
|
|
|
|
|
|
+ //GLOBAL::WriteTextLog("C:超包");
|
|
// 完整包;
|
|
// 完整包;
|
|
_TaskProcess(pIoContext, (SATPROTO::Package*)pSocketContext->lastData.substr(0, phead->len).data());
|
|
_TaskProcess(pIoContext, (SATPROTO::Package*)pSocketContext->lastData.substr(0, phead->len).data());
|
|
|
|
|
|
@@ -800,7 +800,7 @@ void CSATTCPServer::_RecvProcess(PER_SOCKET_CONTEXT* pSocketContext, PER_IO_CONT
|
|
else
|
|
else
|
|
{
|
|
{
|
|
OutputDebugString("D:超包;\n");
|
|
OutputDebugString("D:超包;\n");
|
|
- GLOBAL::WriteTextLog("D:超包");
|
|
|
|
|
|
+ //GLOBAL::WriteTextLog("D:超包");
|
|
lastlen = pSocketContext->lastData.size() + pIoContext->m_Overlapped.InternalHigh - phead->len;
|
|
lastlen = pSocketContext->lastData.size() + pIoContext->m_Overlapped.InternalHigh - phead->len;
|
|
pSocketContext->lastData.append(pIoContext->m_wsaBuf.buf, pIoContext->m_Overlapped.InternalHigh - lastlen);
|
|
pSocketContext->lastData.append(pIoContext->m_wsaBuf.buf, pIoContext->m_Overlapped.InternalHigh - lastlen);
|
|
// 完整包;
|
|
// 完整包;
|
|
@@ -814,7 +814,7 @@ void CSATTCPServer::_RecvProcess(PER_SOCKET_CONTEXT* pSocketContext, PER_IO_CONT
|
|
else
|
|
else
|
|
{
|
|
{
|
|
OutputDebugString("C:仍不足一个包;\n");
|
|
OutputDebugString("C:仍不足一个包;\n");
|
|
- GLOBAL::WriteTextLog("C:仍不足一个包");
|
|
|
|
|
|
+ //GLOBAL::WriteTextLog("C:仍不足一个包");
|
|
pSocketContext->lastData.append(pIoContext->m_wsaBuf.buf, pIoContext->m_Overlapped.InternalHigh);
|
|
pSocketContext->lastData.append(pIoContext->m_wsaBuf.buf, pIoContext->m_Overlapped.InternalHigh);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -826,7 +826,7 @@ void CSATTCPServer::_RecvProcess(PER_SOCKET_CONTEXT* pSocketContext, PER_IO_CONT
|
|
if ( diflen > pIoContext->m_Overlapped.InternalHigh )
|
|
if ( diflen > pIoContext->m_Overlapped.InternalHigh )
|
|
{
|
|
{
|
|
OutputDebugString("B:仍不足一个包头;\n");
|
|
OutputDebugString("B:仍不足一个包头;\n");
|
|
- GLOBAL::WriteTextLog("B:仍不足一个包头");
|
|
|
|
|
|
+ //GLOBAL::WriteTextLog("B:仍不足一个包头");
|
|
pSocketContext->lastData.append(pIoContext->m_wsaBuf.buf, pIoContext->m_Overlapped.InternalHigh);
|
|
pSocketContext->lastData.append(pIoContext->m_wsaBuf.buf, pIoContext->m_Overlapped.InternalHigh);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
@@ -837,7 +837,7 @@ void CSATTCPServer::_RecvProcess(PER_SOCKET_CONTEXT* pSocketContext, PER_IO_CONT
|
|
if ( !CheckDataHeader(phead) )
|
|
if ( !CheckDataHeader(phead) )
|
|
{
|
|
{
|
|
OutputDebugString("B:包头损坏;\n");
|
|
OutputDebugString("B:包头损坏;\n");
|
|
- GLOBAL::WriteTextLog("B:包头损坏");
|
|
|
|
|
|
+ //GLOBAL::WriteTextLog("B:包头损坏");
|
|
pSocketContext->lastData.clear();
|
|
pSocketContext->lastData.clear();
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -846,7 +846,7 @@ void CSATTCPServer::_RecvProcess(PER_SOCKET_CONTEXT* pSocketContext, PER_IO_CONT
|
|
if ( phead->len == PAK_LEN + pIoContext->m_Overlapped.InternalHigh - diflen )
|
|
if ( phead->len == PAK_LEN + pIoContext->m_Overlapped.InternalHigh - diflen )
|
|
{
|
|
{
|
|
OutputDebugString("B:完整包;\n");
|
|
OutputDebugString("B:完整包;\n");
|
|
- GLOBAL::WriteTextLog("B:完整包");
|
|
|
|
|
|
+ //GLOBAL::WriteTextLog("B:完整包");
|
|
pSocketContext->lastData.append(pIoContext->m_wsaBuf.buf + diflen, pIoContext->m_Overlapped.InternalHigh - diflen);
|
|
pSocketContext->lastData.append(pIoContext->m_wsaBuf.buf + diflen, pIoContext->m_Overlapped.InternalHigh - diflen);
|
|
_TaskProcess(pIoContext, (SATPROTO::Package*)pSocketContext->lastData.data());
|
|
_TaskProcess(pIoContext, (SATPROTO::Package*)pSocketContext->lastData.data());
|
|
pSocketContext->lastData.clear();
|
|
pSocketContext->lastData.clear();
|
|
@@ -855,14 +855,14 @@ void CSATTCPServer::_RecvProcess(PER_SOCKET_CONTEXT* pSocketContext, PER_IO_CONT
|
|
else if ( phead->len > PAK_LEN + pIoContext->m_Overlapped.InternalHigh - diflen)
|
|
else if ( phead->len > PAK_LEN + pIoContext->m_Overlapped.InternalHigh - diflen)
|
|
{
|
|
{
|
|
OutputDebugString("B:小包;\n");
|
|
OutputDebugString("B:小包;\n");
|
|
- GLOBAL::WriteTextLog("B:小包");
|
|
|
|
|
|
+ //GLOBAL::WriteTextLog("B:小包");
|
|
pSocketContext->lastData.append(pIoContext->m_wsaBuf.buf + diflen, pIoContext->m_Overlapped.InternalHigh - diflen);
|
|
pSocketContext->lastData.append(pIoContext->m_wsaBuf.buf + diflen, pIoContext->m_Overlapped.InternalHigh - diflen);
|
|
}
|
|
}
|
|
// 超包;
|
|
// 超包;
|
|
else if (phead->len < PAK_LEN + pIoContext->m_Overlapped.InternalHigh - diflen)
|
|
else if (phead->len < PAK_LEN + pIoContext->m_Overlapped.InternalHigh - diflen)
|
|
{
|
|
{
|
|
OutputDebugString("B:超包;\n");
|
|
OutputDebugString("B:超包;\n");
|
|
- GLOBAL::WriteTextLog("B:超包");
|
|
|
|
|
|
+ //GLOBAL::WriteTextLog("B:超包");
|
|
// 组完成包;
|
|
// 组完成包;
|
|
pSocketContext->lastData.append(pIoContext->m_wsaBuf.buf + diflen, phead->len - PAK_LEN);
|
|
pSocketContext->lastData.append(pIoContext->m_wsaBuf.buf + diflen, phead->len - PAK_LEN);
|
|
_TaskProcess(pIoContext, (SATPROTO::Package*)pSocketContext->lastData.data());
|
|
_TaskProcess(pIoContext, (SATPROTO::Package*)pSocketContext->lastData.data());
|