Click here to Skip to main content
15,893,337 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: #ifndef Pin
Alain Rist16-Nov-10 21:04
Alain Rist16-Nov-10 21:04 
AnswerRe: #ifndef Pin
David Crow17-Nov-10 3:16
David Crow17-Nov-10 3:16 
QuestionHow can handle this exception? Pin
Le@rner16-Nov-10 19:00
Le@rner16-Nov-10 19:00 
AnswerRe: How can handle this exception? Pin
Alain Rist16-Nov-10 21:00
Alain Rist16-Nov-10 21:00 
GeneralRe: How can handle this exception? [modified] Pin
Le@rner16-Nov-10 21:06
Le@rner16-Nov-10 21:06 
GeneralRe: How can handle this exception? Pin
Cedric Moonen16-Nov-10 21:17
Cedric Moonen16-Nov-10 21:17 
GeneralRe: How can handle this exception? Pin
Alain Rist16-Nov-10 21:23
Alain Rist16-Nov-10 21:23 
GeneralRe: How can handle this exception? Pin
Le@rner16-Nov-10 22:41
Le@rner16-Nov-10 22:41 
its generate using this line

CSMTP smtp;

StatusTh  = smtp.get_response();

//where
CString CSMTP::get_response()
{
	try
	{
		char buf[240];
		sock_error=WSAGetLastError();
		if(sock_error!=0)
		{
			if(sock_error==10048)
				sock_str = "10048*Address already in use";
			else if(sock_error==10049)
				sock_str = "10049*Cannot assign requested address";
			else if(sock_error==10050)
				sock_str = "10050*Network is down";
			else if(sock_error==10051)
				sock_str = "10051*Network is unreachable";
			else if(sock_error==10060)
				sock_str = "10060*Connection timed out";
			else if(sock_error==10064)
				sock_str = "10064*Host is down";
			else if(sock_error==10061)
				sock_str = "10061*Connection refused";
			else if(sock_error==10054)
				sock_str = "10054*Connection reset by peer";
			else
			{
				sock_str.Format("%d",sock_error);
				sock_str = sock_str + "*Socket Error";
			}
			return sock_str;
		}
		recv(sock,buf,sizeof(buf),0);
		sock_error=WSAGetLastError();
		if(sock_error!=0)
		{
			if(sock_error==10048)
				sock_str = "10048*Address already in use";
			else if(sock_error==10049)
				sock_str = "10049*Cannot assign requested address";
			else if(sock_error==10050)
				sock_str = "10050*Network is down";
			else if(sock_error==10051)
				sock_str = "10051*Network is unreachable";
			else if(sock_error==10060)
				sock_str = "10060*Connection timed out";
			else if(sock_error==10064)
				sock_str = "10064*Host is down";
			else if(sock_error==10061)
				sock_str = "10061*Connection refused";
			else if(sock_error==10054)
				sock_str = "10054*Connection reset by peer";
			else
			{
				sock_str.Format("%d",sock_error);
				sock_str = sock_str + "*Socket Error";
			}
			return sock_str;
		}
		else
		{ 
			CString temp = buf;
			return temp;
		}
	}
	catch( CMemoryException* e )
	{
	   // Handle the out-of-memory exception here.
	   e->Delete();
	}
	catch( CFileException* e )
	{
	   // Handle the file exceptions here.
	   e->Delete();
	}
	catch( CException* e )
	{
	   // Handle all other types of exceptions here.
	   e->Delete();
	}
}

GeneralRe: How can handle this exception? Pin
Cedric Moonen16-Nov-10 22:51
Cedric Moonen16-Nov-10 22:51 
AnswerRe: How can handle this exception? Pin
Alain Rist16-Nov-10 22:55
Alain Rist16-Nov-10 22:55 
GeneralRe: How can handle this exception? Pin
Le@rner16-Nov-10 23:15
Le@rner16-Nov-10 23:15 
GeneralRe: How can handle this exception? Pin
Cedric Moonen16-Nov-10 23:43
Cedric Moonen16-Nov-10 23:43 
GeneralRe: How can handle this exception? Pin
Alain Rist17-Nov-10 0:05
Alain Rist17-Nov-10 0:05 
GeneralRe: How can handle this exception? Pin
Cedric Moonen16-Nov-10 23:41
Cedric Moonen16-Nov-10 23:41 
GeneralRe: How can handle this exception? Pin
Alain Rist17-Nov-10 0:11
Alain Rist17-Nov-10 0:11 
GeneralRe: How can handle this exception? Pin
Le@rner17-Nov-10 0:35
Le@rner17-Nov-10 0:35 
GeneralRe: How can handle this exception? Pin
Alain Rist17-Nov-10 1:29
Alain Rist17-Nov-10 1:29 
QuestionRe: How can handle this exception? Pin
David Crow17-Nov-10 3:19
David Crow17-Nov-10 3:19 
Questionbuffer filled with trash [modified] Pin
ALLERSLIT16-Nov-10 13:22
ALLERSLIT16-Nov-10 13:22 
AnswerRe: buffer filled with trash Pin
Stephen Hewitt16-Nov-10 17:35
Stephen Hewitt16-Nov-10 17:35 
GeneralRe: buffer filled with trash Pin
Richard MacCutchan16-Nov-10 21:22
mveRichard MacCutchan16-Nov-10 21:22 
QuestionAccessing vector in another class?? Pin
AmbiguousName16-Nov-10 0:53
AmbiguousName16-Nov-10 0:53 
AnswerRe: Accessing vector in another class?? Pin
Chris Losinger16-Nov-10 1:37
professionalChris Losinger16-Nov-10 1:37 
AnswerRe: Accessing vector in another class?? Pin
Richard MacCutchan16-Nov-10 1:40
mveRichard MacCutchan16-Nov-10 1:40 
GeneralRe: Accessing vector in another class?? Pin
AmbiguousName16-Nov-10 2:14
AmbiguousName16-Nov-10 2:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.