sockserver.cpp
来自「sms短信模拟程序」· C++ 代码 · 共 74 行
CPP
74 行
// SockServer.cpp : implementation file
//
#include "stdafx.h"
#include "comtra.h"
#include "SockServer.h"
#include "comtraDoc.h"
#include "comtraView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// SockServer
SockServer::SockServer()
{
}
SockServer::~SockServer()
{
}
// Do not edit the following lines, which are needed by ClassWizard.
#if 0
BEGIN_MESSAGE_MAP(SockServer, CAsyncSocket)
//{{AFX_MSG_MAP(SockServer)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
#endif // 0
/////////////////////////////////////////////////////////////////////////////
// SockServer member functions
void SockServer::OnAccept(int nErrorCode)
{
// TODO: Add your specialized code here and/or call the base class
CComtraView *pView = CComtraView::GetView();
pView->OnSocketAccept(nErrorCode);
CAsyncSocket::OnAccept(nErrorCode);
}
void SockServer::OnClose(int nErrorCode)
{
// TODO: Add your specialized code here and/or call the base class
CComtraView *pView = CComtraView::GetView();
pView->OnSocketClose(nErrorCode);
CAsyncSocket::OnClose(nErrorCode);
}
void SockServer::OnReceive(int nErrorCode)
{
// TODO: Add your specialized code here and/or call the base class
if(nErrorCode == 0)
{
CComtraView *pView = CComtraView::GetView();
pView->OnSocketReceive(nErrorCode);
}
CAsyncSocket::OnReceive(nErrorCode);
}
int SockServer::Receive(void* lpBuf, int nBufLen, int nFlags)
{
// TODO: Add your specialized code here and/or call the base class
return CAsyncSocket::Receive(lpBuf, nBufLen, nFlags);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?