CAsyncSocket: OnReceive() 一次TCP联接接收后会调用两次吗

CAsyncSocket:: OnReceive() 一次TCP连接接收后会调用两次吗
CAsyncSocket: OnReceive() 一次TCP联接接收后会调用两次吗
服务端只是将客户端的信息直接回传

#pragma once
#include "afxsock.h"

class MyCAsyncSocket :
public CAsyncSocket
{
public:
MyCAsyncSocket(void);
~MyCAsyncSocket(void);
virtual void OnAccept(int nErrorCode);
virtual void OnConnect(int nErrorCode);
virtual void OnReceive(int nErrorCode);
virtual void OnSend(int nErrorCode);
public:
BOOL m_bConnceted; //是否连接
UINT m_nLength;//消息长度
CHAR m_szBuffer[4096];
};

#include "StdAfx.h"
#include "ChatTCP.h"
#include "ChatTCPDlg.h"


MyCAsyncSocket::MyCAsyncSocket(void)
{
m_bConnceted=FALSE;
m_nLength=0;
memset(m_szBuffer,0,sizeof(m_szBuffer));
}

MyCAsyncSocket::~MyCAsyncSocket(void)
{
//关闭套接字
if (m_hSocket != INVALID_SOCKET)
{
Close();
}
}

void MyCAsyncSocket::OnAccept(int nErrorCode)
{
// TODO: 在此添加专用代码和/或调用基类

CAsyncSocket::OnAccept(nErrorCode);
}

void MyCAsyncSocket::OnConnect(int nErrorCode)
{
//0   The function executed successfully.

if (0 == nErrorCode)
{
m_bConnceted=TRUE;
CChatTCPApp* pAPP=(CChatTCPApp*)AfxGetApp();
CChatTCPDlg* pDlg=(CChatTCPDlg*)pAPP->m_pMainWnd;
//CString  strAddr;
//  pDlg->GetDlgItemText(IDC_EDIT_HOSTNAME,strAddr);
//  memcpy(pDlg->m_szServerAdr,strAddr.GetBuffer(),strAddr.GetLength());
memcpy(m_szBuffer,"Connected to ",sizeof("Connected to "));
strncat(m_szBuffer,pDlg->m_szServerAdr,sizeof(pDlg->m_szServerAdr));
pDlg->m_MSGS.InsertString(0,m_szBuffer);
memset(m_szBuffer,0,sizeof(m_szBuffer));
//AsyncSelect(FD_READ);  //读网络事件

}
else
{
switch( nErrorCode )
{
case WSAEADDRINUSE: 
AfxMessageBox("The specified address is already in use.\n");
break;
case WSAEADDRNOTAVAIL: 
AfxMessageBox("The specified address is not available from \
the local machine.\n");
break;
case WSAEAFNOSUPPORT: 
AfxMessageBox("Addresses in the specified family cannot be \
used with this socket.\n");
break;
case WSAECONNREFUSED: 
AfxMessageBox("The attempt to connect was forcefully \
rejected.\n");
break;
case WSAEDESTADDRREQ: 
AfxMessageBox("A destination address is required.\n");
break;
case WSAEFAULT: 
AfxMessageBox("The lpSockAddrLen argument is incorrect.\n");
break;
case WSAEINVAL: 
AfxMessageBox("The socket is already bound to an \
address.\n");
break;
case WSAEISCONN: 
AfxMessageBox("The socket is already connected.\n");
break;
case WSAEMFILE: 
AfxMessageBox("No more file descriptors are available.\n");
break;
case WSAENETUNREACH: 
AfxMessageBox("The network cannot be reached from this host \
at this time.\n");
break;
case WSAENOBUFS: 
AfxMessageBox("No buffer space is available. The socket \