-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyAsyncSocket.cpp
More file actions
106 lines (87 loc) · 2.37 KB
/
MyAsyncSocket.cpp
File metadata and controls
106 lines (87 loc) · 2.37 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// MyAsyncSocket.cpp : implementation file
//
// Skip Morrow
// 04 May 2000
#include "stdafx.h"
#include "MFCAsyncPhoneServer.h"
#include "MFCAsyncPhoneServerDlg.h"
#include "MyAsyncSocket.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// MyAsyncSocket
MyAsyncSocket::MyAsyncSocket()
{
}
MyAsyncSocket::~MyAsyncSocket()
{
}
void MyAsyncSocket::SetParent(CDialog *pWnd)
{
m_pWnd = pWnd;
}
// because CMyAsyncSocket is derived from CAsyncSocket, these functions are called
// automatically when these events happen. They simply call the related function
// located in the parent class.
// Once an accept happens, call the OnAccept() function of the dlg class
void MyAsyncSocket::OnAccept(int iErrorCode)
{
// AfxMessageBox("MyAsyncSocket Accept() Called");
if (iErrorCode == 0)
{
// AfxMessageBox("MyAsyncSocket Accept() Successful");
((CMFCAsyncPhoneServerDlg*)m_pWnd)->OnAccept();
}
else
{
AfxMessageBox("Error Code: " + (CString)iErrorCode);
}
}
// none of these functions should execute, but they are here because they help
// with debugging and they are required to be overridden due to the fact
// that they are pure virtual functions in CAsyncSocket
void MyAsyncSocket::OnConnect(int iErrorCode)
{
// AfxMessageBox("void CMyAsyncSocket::OnConnect(int iErrorCode)");
if (iErrorCode == 0)
{
((CMFCAsyncPhoneServerDlg*)m_pWnd)->OnConnect();
}
}
void MyAsyncSocket::OnClose(int iErrorCode)
{
// AfxMessageBox("void CMyAsyncSocket::OnClose(int iErrorCode)");
if (iErrorCode == 0)
{
((CMFCAsyncPhoneServerDlg*)m_pWnd)->OnClose();
}
}
void MyAsyncSocket::OnReceive(int iErrorCode)
{
// AfxMessageBox("void CMyAsyncSocket::OnReceive(int iErrorCode)");
if (iErrorCode == 0)
{
((CMFCAsyncPhoneServerDlg*)m_pWnd)->OnReceive();
}
}
void MyAsyncSocket::OnSend(int iErrorCode)
{
// AfxMessageBox("void CMyAsyncSocket::OnSend(int iErrorCode)");
if (iErrorCode == 0)
{
((CMFCAsyncPhoneServerDlg*)m_pWnd)->OnSend();
}
}
// Do not edit the following lines, which are needed by ClassWizard.
#if 0
BEGIN_MESSAGE_MAP(MyAsyncSocket, CAsyncSocket)
//{{AFX_MSG_MAP(MyAsyncSocket)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
#endif // 0
/////////////////////////////////////////////////////////////////////////////
// MyAsyncSocket member functions
// eof MyAsyncSocket