tcpsocket.cpp

来自「这是一个串口和以太网口的透传转换程序」· C++ 代码 · 共 87 行

CPP
87
字号
// TCPSocket.cpp : implementation file
//

#include "stdafx.h"
#include "Tcp2Serial.h"
#include "TCPSocket.h"
#include "Tcp2SerialDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CTCPSocket

CTCPSocket::CTCPSocket()
{
}

CTCPSocket::~CTCPSocket()
{
}


// Do not edit the following lines, which are needed by ClassWizard.
#if 0
BEGIN_MESSAGE_MAP(CTCPSocket, CAsyncSocket)
	//{{AFX_MSG_MAP(CTCPSocket)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()
#endif	// 0

/////////////////////////////////////////////////////////////////////////////
// CTCPSocket member functions
void CTCPSocket::SetPart( CDialog* dlg )
{
	m_dlg = dlg;
}

void CTCPSocket::OnSend( int nErrorCode )
{
	if ( nErrorCode == 0 )
	{
        (( CTcp2SerialDlg* )m_dlg )->OnSend();
	}
	CAsyncSocket::OnSend( nErrorCode );
}

void CTCPSocket::OnAccept( int nErrorCode )
{
	if ( nErrorCode == 0 )
	{
        (( CTcp2SerialDlg* )m_dlg )->OnAccecp();
	}
	CAsyncSocket::OnAccept( nErrorCode );
}

void CTCPSocket::OnReceive( int nErrorCode )
{
	if ( nErrorCode == 0 )
	{
        (( CTcp2SerialDlg* )m_dlg )->OnReceive();
	}
	CAsyncSocket::OnReceive(nErrorCode);
}

void CTCPSocket::OnClose( int nErrorCode )
{
	// TODO: Add your specialized code here and/or call the base class
	if ( nErrorCode == 0 )
	{
        (( CTcp2SerialDlg* )m_dlg )->OnClose();
	}
	CAsyncSocket::OnClose( nErrorCode );
}

void CTCPSocket::OnConnect( int nErrorCode )
{
	if ( nErrorCode == 0 )
	{
        (( CTcp2SerialDlg* )m_dlg )->OnConnect();
	}
	CAsyncSocket::OnConnect( nErrorCode );
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?