soket问题
void CClientDlg::OnDestroy()
{
CDialog::OnDestroy();
// TODO: Add your message handler code here
m_bAutoChat=FALSE;
if ((m_pSocket!=NULL)&&(m_pFile!=NULL)&&(m_pArchiveOut!=NULL))
{
//发送客户离开聊天室的消息
CMsg msg;
CString strTemp;
strTemp=":离开聊天室!";
msg.m_bClose=TRUE;
msg.m_strText=m_strHandle+strTemp;
msg.Serialize(*m_pArchiveOut);
m_pArchiveOut->Flush();
}
//删除CArchive对象
delete m_pArchiveOut;
m_pArchiveOut=NULL;
//删除CArchive对象
delete m_pArchiveIn;
m_pArchiveIn=NULL;
delete m_pFile;
//删除CSOcketFile对象
m_pFile=NULL;/////////////////////////下面这段代吗什么意思,为什么不直接m_pSocket->close()
if (m_pSocket!=NULL)
{
BYTE Buffer[50];
m_pSocket->ShutDown();
while (m_pSocket->Receive(Buffer,50)>0);
}
delete m_pSocket;
m_pSocket=NULL;
}