Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Cityhunter

MFC CAsyncSocket create problems

This topic is 5804 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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;
}

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!