MFC CAsyncSocket create problems
Hi
I''m deriving a socket class from the MFC CAsyncSocket class, when I call the CAsyncSocket''s create function the create fails.
I have the same code in a different program and the socket create works just fine.
Does anyone have any idea on what the problem might be?
Thanks
quote:
Original post by Cityhunter
Hi
I''m deriving a socket class from the MFC CAsyncSocket class, when I call the CAsyncSocket''s create function the create fails.
I have the same code in a different program and the socket create works just fine.
Does anyone have any idea on what the problem might be?
Thanks
1) In StdAfx.h add string:
#include <afxsock.h>
2) In begin function: .....App::InitInstance()
Add:
if (!AfxSocketInit())
{
AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
return FALSE;
}
It''s help.
And offten use, it''s real help you know error
try {
...
code
...
} catch(CException* e) {
TCHAR szCause[255];
CString strFormatted;
e->GetErrorMessage(szCause, 255);
strFormatted = _T("Error exception: \n");
strFormatted += szCause;
AfxMessageBox(strFormatted);
return NULL;
}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement