?? clientsocket.cpp
字號:
// ClientSocket.cpp : implementation file
//
#include "stdafx.h"
#include "HTTPClient.h"
#include "ClientSocket.h"
#include "HttpClientView.h"
#include "clientsocket.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CClientSocket
CClientSocket::CClientSocket(CHTTPClientView* pView)
{
m_pView = pView;
}
CClientSocket::~CClientSocket()
{
}
// Do not edit the following lines, which are needed by ClassWizard.
#if 0
BEGIN_MESSAGE_MAP(CClientSocket, CAsyncSocket)
//{{AFX_MSG_MAP(CClientSocket)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
#endif // 0
/////////////////////////////////////////////////////////////////////////////
// CClientSocket member functions
void CClientSocket::OnReceive(int nErrorCode)
{
m_pView->Receive();
CAsyncSocket::OnReceive(nErrorCode);
}
void CClientSocket::OnSend(int nErrorCode)
{
CAsyncSocket::OnSend(nErrorCode);
}
void CClientSocket::OnConnect(int nErrorCode)
{
if(nErrorCode != 0){
int nRet = AfxMessageBox("連接服務器失敗,是否重試?",MB_OKCANCEL);
if(nRet == IDOK){
m_pView->Connect();
return;
}
else
return;
}
m_pView->m_bConnected = TRUE;
m_pView->TextOut("成功連接到服務器!\n", RGB(255,122,100));
if(m_pView->m_bSend){
m_pView->SendData();
m_pView->m_bSend = FALSE;
}
CAsyncSocket::OnConnect(nErrorCode);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -