📄 socksrv.cpp
字号:
// SockSrv.cpp : implementation file
//
#include "stdafx.h"
#include "NetElectronSrvDlg.h"
#include "NetElectronSrv.h"
#include "SockSrv.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSockSrv
CSockSrv::CSockSrv()
{
m_CommState = CSTATE_START;
m_pWndOwner = NULL;
}
CSockSrv::~CSockSrv()
{
}
// Do not edit the following lines, which are needed by ClassWizard.
#if 0
BEGIN_MESSAGE_MAP(CSockSrv, CSocket)
//{{AFX_MSG_MAP(CSockSrv)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
#endif // 0
/////////////////////////////////////////////////////////////////////////////
// CSockSrv member functions
void CSockSrv::SetData(CWnd *pWndOwner)
{
m_pWndOwner = pWndOwner;
ASSERT ( m_pWndOwner );
}
void CSockSrv::OnAccept(int nErrorCode)
{
Log ( "接受客户请求,代码 - %d", nErrorCode );
CSocket::OnAccept(nErrorCode);
}
void CSockSrv::OnClose(int nErrorCode)
{
Log ( "客户连接已经关闭" );
CSocket::OnClose(nErrorCode);
}
void CSockSrv::OnConnect(int nErrorCode)
{
Log ( "和客户建立连接,代码 - %d", nErrorCode );
CSocket::OnConnect(nErrorCode);
}
void CSockSrv::OnReceive(int nErrorCode)
{
char buf[1024] = {0};
int nLen = Receive ( buf, sizeof(buf) );
HandleWhenReceivedData ( buf, nLen );
CSocket::OnReceive(nErrorCode);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -