-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMySocket.cpp
More file actions
62 lines (52 loc) · 903 Bytes
/
MySocket.cpp
File metadata and controls
62 lines (52 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// MySocket.cpp : 实现文件
//
#include "stdafx.h"
#include "ChatClient.h"
#include "MySocket.h"
//ADD
#include "ChatClientDlg.h"
//ADD
// MySocket
MySocket::MySocket()
{
}
MySocket::~MySocket()
{
}
// MySocket 成员函数
//ADD
void MySocket::GetDlg(CChatClientDlg * dlg) //获得窗口界面的指针
{
m_dlg=dlg;
}
//ADD
void MySocket::OnClose(int nErrorCode)
{
// TODO: 在此添加专用代码和/或调用基类
//ADD
m_dlg->OnClose();
//ADD
CAsyncSocket::OnClose(nErrorCode);
}
void MySocket::OnConnect(int nErrorCode)
{
// TODO: 在此添加专用代码和/或调用基类
//ADD
//确认客户端是否成功连接到服务器
if(nErrorCode)
{
AfxMessageBox("连接失败,请您重试!");
return;
}
m_dlg->OnConnect();
//ADD
CAsyncSocket::OnConnect(nErrorCode);
}
void MySocket::OnReceive(int nErrorCode)
{
// TODO: 在此添加专用代码和/或调用基类
//ADD
m_dlg->OnReceive();
//ADD
CAsyncSocket::OnReceive(nErrorCode);
}