📄 sockserver.cpp
字号:
// 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -