www.pudn.com > HttpServerusingWinSocket.rar > MyBlockSocketException.cpp


// MyBlockSocketException.cpp: implementation of the CMyBlockSocketException class. 
// 
////////////////////////////////////////////////////////////////////// 
 
#include "stdafx.h" 
#include "HttpServer.h" 
#include "MyBlockSocketException.h" 
 
#ifdef _DEBUG 
#undef THIS_FILE 
static char THIS_FILE[]=__FILE__; 
#define new DEBUG_NEW 
#endif 
 
////////////////////////////////////////////////////////////////////// 
// Construction/Destruction 
////////////////////////////////////////////////////////////////////// 
IMPLEMENT_DYNAMIC(CMyBlockSocketException,CException) 
 
CMyBlockSocketException::CMyBlockSocketException() 
{ 
 
} 
CMyBlockSocketException::CMyBlockSocketException(char * pchMessage) 
{	 
	m_strMessage=pchMessage; 
	m_nError=WSAGetLastError(); 
} 
 
BOOL CMyBlockSocketException::GetErrorMessage(LPTSTR lpstrError,UINT nMaxError,PUINT pnHelpContext/*=NULL*/){ 
	char text[200]; 
	if(m_nError==0){ 
		wsprintf(text,"%s ´íÎó",(const char*)m_strMessage); 
	} else{ 
		wsprintf(text,"%s ´íÎóºÅ£º%d",(const char*)m_strMessage,m_nError); 
	} 
	strncpy(lpstrError,text,nMaxError-1); 
	return TRUE; 
} 
 
CMyBlockSocketException::~CMyBlockSocketException() 
{ 
 
}