Click here to Skip to main content
15,886,110 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Displaying as much text as possible Pin
Code-o-mat18-Nov-10 2:00
Code-o-mat18-Nov-10 2:00 
Questionboost ::asio:async_read_until usage/question from a newbie boost user Pin
Alan Kurlansky17-Nov-10 3:17
Alan Kurlansky17-Nov-10 3:17 
Questionfont size Pin
john563217-Nov-10 2:33
john563217-Nov-10 2:33 
AnswerRe: font size Pin
Richard MacCutchan17-Nov-10 2:46
mveRichard MacCutchan17-Nov-10 2:46 
GeneralRe: font size Pin
john563217-Nov-10 2:52
john563217-Nov-10 2:52 
QuestionRe: font size Pin
David Crow17-Nov-10 3:11
David Crow17-Nov-10 3:11 
AnswerRe: font size [modified] Pin
Richard MacCutchan17-Nov-10 9:06
mveRichard MacCutchan17-Nov-10 9:06 
QuestionPlease tell me whats wrong with function? Pin
Le@rner17-Nov-10 0:42
Le@rner17-Nov-10 0:42 
Hi all,

i m using this function

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";
			}
			//sock_str=sock_str+"\0";
			return sock_str;
		}
		int res = recv(sock,buf,sizeof(buf),0);
		if (res != SOCKET_ERROR)
		{
			buf[res] = 0;		// NULL terminate.
		}

		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";
			}
			//sock_str=sock_str+"\0";
			return sock_str;
		}
		else
		{ 
			//CString temp = buf;
			//return temp;
			return buf;
		}
	}
	catch ( CInternetException* e )
	{
		// Handle Internet exception here.
	   e->Delete();
	}
	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();
	}
}


where i call this function its generate exception,please tell me what wrong with function.

its callstack is
	ntdll.dll!7788ac0f() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]	
 	ntdll.dll!7788a58b() 	
 	kernel32.dll!76623f01() 	
>	Test.exe!free(void * pBlock=0x410f28f0)  Line 110	C
 	Test.exe!CMemFile::Free(unsigned char * lpMem=0x410f28f0)  Line 118 + 0x8 bytes	C++
 	Test.exe!ATL::CStringData::Release()  Line 113	C++
 	Test.exe!CSMTP::~CSMTP()  Line 13 + 0x1c bytes	C++
 	Test.exe!CSmtp_Mon_Thread::SmtpResponseThread(ATL::CStringT<char,StrTraitMFC<char,ATL::ChTraitsCRT<char> > > URL_Name="http://dezsredstva.ru", unsigned int Port=1091512576)  Line 227 + 0x13 bytes	C++
 	Test.exe!CSmtp_Mon_Thread::OnSmtpTimer(unsigned int idEvent=22610, long dwTime=11655606)  Line 69	C++
 	Test.exe!CWinThread::DispatchThreadMessageEx(tagMSG * pMsg=0x093e7cf8)  Line 771	C++
 	Test.exe!AfxInternalPreTranslateMessage(tagMSG * pMsg=0x093e7cf8)  Line 227 + 0xd bytes	C++
 	Test.exe!CWinThread::PreTranslateMessage(tagMSG * pMsg=0x093e7cf8)  Line 777 + 0x8 bytes	C++
 	Test.exe!AfxPreTranslateMessage(tagMSG * pMsg=0x093e7cf8)  Line 255	C++
 	Test.exe!AfxInternalPumpMessage()  Line 178 + 0xf bytes	C++
 	Test.exe!CWinThread::Run()  Line 629 + 0x7 bytes	C++
 	Test.exe!_AfxThreadEntry(void * pParam=0x0023f25c)  Line 126	C++
 	Test.exe!_callthreadstartex()  Line 348 + 0x6 bytes	C
 	Test.exe!_threadstartex(void * ptd=0x02b2fcd8)  Line 326 + 0x5 bytes	C
 	kernel32.dll!7662eccb() 	
 	ntdll.dll!778dd24d() 	
 	ntdll.dll!778dd45f() 	

thanks in advance
AnswerRe: Please tell me whats wrong with function? Pin
Stephen Hewitt17-Nov-10 0:55
Stephen Hewitt17-Nov-10 0:55 
AnswerRe: Please tell me whats wrong with function? PinPopular
Cedric Moonen17-Nov-10 0:57
Cedric Moonen17-Nov-10 0:57 
GeneralRe: Please tell me whats wrong with function? Pin
Le@rner17-Nov-10 1:00
Le@rner17-Nov-10 1:00 
GeneralRe: Please tell me whats wrong with function? Pin
Cedric Moonen17-Nov-10 1:06
Cedric Moonen17-Nov-10 1:06 
QuestionRe: Please tell me whats wrong with function? Pin
CPallini17-Nov-10 1:21
mveCPallini17-Nov-10 1:21 
JokeRe: Please tell me whats wrong with function? Pin
Code-o-mat17-Nov-10 2:08
Code-o-mat17-Nov-10 2:08 
GeneralRe: Please tell me whats wrong with function? Pin
CPallini17-Nov-10 2:16
mveCPallini17-Nov-10 2:16 
JokeRe: Please tell me whats wrong with function? Pin
Code-o-mat17-Nov-10 2:21
Code-o-mat17-Nov-10 2:21 
AnswerRe: Please tell me whats wrong with function? [modified] Pin
Alain Rist17-Nov-10 3:50
Alain Rist17-Nov-10 3:50 
GeneralRe: Please tell me whats wrong with function? Pin
CPallini17-Nov-10 5:26
mveCPallini17-Nov-10 5:26 
AnswerRe: Please tell me whats wrong with function? Pin
super17-Nov-10 2:23
professionalsuper17-Nov-10 2:23 
QuestionRe: Please tell me whats wrong with function? Pin
David Crow17-Nov-10 3:15
David Crow17-Nov-10 3:15 
Question#ifndef Pin
vidhyaej16-Nov-10 20:21
vidhyaej16-Nov-10 20:21 
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 

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.