ChatSock.cpp
资源名称:anywhere.zip [点击查看]
上传用户:zhenhuadz
上传日期:2007-01-07
资源大小:1511k
文件大小:1k
源码类别:
远程控制编程
开发平台:
Visual C++
- // ChatSock.cpp : implementation file
- //
- #include "stdafx.h"
- #include "AnyServer.h"
- #include "ChatSock.h"
- #include "AnyServerDoc.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CChatSock
- CChatSock::CChatSock()
- {
- }
- CChatSock::~CChatSock()
- {
- if (m_pArchiveOut != NULL)
- delete m_pArchiveOut;
- if (m_pArchiveIn != NULL)
- delete m_pArchiveIn;
- if (m_pFile != NULL)
- delete m_pFile;
- }
- // Do not edit the following lines, which are needed by ClassWizard.
- #if 0
- BEGIN_MESSAGE_MAP(CChatSock, CSocket)
- //{{AFX_MSG_MAP(CChatSock)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- #endif // 0
- /////////////////////////////////////////////////////////////////////////////
- // CChatSock member functions
- CChatSock::CChatSock(CAnyServerDoc* pDoc)
- {
- m_pDoc=pDoc;
- }
- void CChatSock::OnReceive(int nErrorCode)
- {
- CSocket::OnReceive(nErrorCode);
- m_pDoc->ProcessPendingRead(this);
- }
- void CChatSock::init()
- {
- m_pFile = new CSocketFile(this);
- m_pArchiveIn = new CArchive(m_pFile,CArchive::load);
- m_pArchiveOut = new CArchive(m_pFile,CArchive::store);
- }