mysocket.cpp

来自「网上搜的关于语音聊天的语音聊天系统」· C++ 代码 · 共 60 行

CPP
60
字号
// mysocket.cpp: implementation of the mysocket class.
//
//////////////////////////////////////////////////////////////////////
#include<afxwin.h>
#include<afxsock.h>
#include "mysocket.h"
#include "Serdlg.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

mysocket::mysocket()
{
name="";
}

mysocket::~mysocket()
{

}

void mysocket::setparent(CDialog *dialog)
{
dlg=dialog;
}


//
// This function will be called when the client connects to
// the Server.
//

void mysocket::OnAccept(int errcode)
{
	if(errcode==0)
	((Serdlg*)dlg)->Accept();

	CSocket::OnAccept(errcode);
}

//
// This function is gets invoked when the socket recieves the
// data from the remote socket
//

void mysocket::OnReceive(int errcode)
{
	
	if(errcode==0)
	((Serdlg*)dlg)->Receive(this);

	CSocket::OnAccept(errcode);
}

void mysocket::OnClose(int errcode)
{
	if(errcode==0)
	((Serdlg*)dlg)->OnCloseClient(this);

}

⌨️ 快捷键说明

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