ChatSock.cpp
资源名称:(vc).rar [点击查看]
上传用户:wpp2016
上传日期:2010-02-01
资源大小:1250k
文件大小:1k
源码类别:
Telnet服务器
开发平台:
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);
- }