mysocket.cpp

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

CPP
56
字号
///////////////////////////////////////////////////////////////////
// mysocket.cpp: implementation of the mysocket class.
// Handles communication related details....
//////////////////////////////////////////////////////////////////////


#include<afxwin.h>
#include<afxsock.h>
#include "mysocket.h"
#include"Display.h"



//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

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



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


//
// This function will be invoked when the client receives message
// from remote socket

void mysocket::OnReceive(int errcode)
{
	//call the receive function of Display class.
	if(errcode==0)  
	((Display*)dlg)->Receive();  

	CSocket::OnReceive(errcode);
}

//
// Called when Server has shutdown....
//
//

void mysocket::OnClose(int errcode)
{
	closeflag=1;
	((Display*)dlg)->OnCancel();

}

⌨️ 快捷键说明

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