|
// MySocket.cpp: Implementierung der Klasse CMySocket.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "stdafx.h"
#include "MySocket.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Konstruktion/Destruktion
//////////////////////////////////////////////////////////////////////
CMySocket::CMySocket()
{
}
CMySocket::~CMySocket()
{
}
void CMySocket::OnReceive(int nErrorCode)
{
CAsyncProxySocket::OnReceive(nErrorCode);
if (nErrorCode)
{
AfxMessageBox("Fatal error! Network subsystem failed!",MB_ICONSTOP);
Close();
return;
}
for(;;)
{
char buffer;
int res=Receive(&buffer,1);
if (res==SOCKET_ERROR || !res)
{
if (GetLastError()!=WSAEWOULDBLOCK || !res)
{
AfxMessageBox("Error! Connection has been closed!",MB_ICONEXCLAMATION);
return;
}
break;
}
CString str;
m_pResponse->GetWindowText(str);
str+=buffer;
m_pResponse->SetWindowText(str);
}
}
void CMySocket::OnProxyOperationFailed(int nOpID)
{
AfxMessageBox("Error! Could not connect through proxy!",MB_ICONEXCLAMATION);
}
void CMySocket::OnListenFinished(unsigned long &retProxyIp,int &retProxyPort)
{
}
void CMySocket::OnConnect(int nErrorCode)
{
CAsyncProxySocket::OnConnect(nErrorCode);
if (nErrorCode)
{
if (GetProxyType())
AfxMessageBox("Error! Could not connect to proxy server!",MB_ICONEXCLAMATION);
else
AfxMessageBox("Error! Could not connect to server!",MB_ICONEXCLAMATION);
Close();
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.