-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMySocket.cpp
More file actions
58 lines (48 loc) · 819 Bytes
/
MySocket.cpp
File metadata and controls
58 lines (48 loc) · 819 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
// MySocket.cpp : 实现文件
//
#include "stdafx.h"
#include "ChatServer.h"
#include "MySocket.h"
//ADD
#include "ChatServerDlg.h"
//ADD
// MySocket
MySocket::MySocket()
{
}
MySocket::~MySocket()
{
}
// MySocket 成员函数
//ADD
void MySocket::GetDlg(CChatServerDlg *dlg)
{
m_dlg=dlg;
}
//ADD
void MySocket::OnClose(int nErrorCode)
{
// TODO: 在此添加专用代码和/或调用基类
//ADD
m_dlg->OnClose();
//ADD
CSocket::OnClose(nErrorCode);
}
void MySocket::OnReceive(int nErrorCode)
{
// TODO: 在此添加专用代码和/或调用基类
//ADD
m_dlg->OnReceive();
AsyncSelect(FD_CLOSE|FD_READ|FD_WRITE);
//ADD
CSocket::OnReceive(nErrorCode);
}
void MySocket::OnAccept(int nErrorCode)
{
// TODO: 在此添加专用代码和/或调用基类
//ADD
if(m_dlg->m_ServerSocket==NULL)
m_dlg->OnAccept();
//ADD
CSocket::OnAccept(nErrorCode);
}