Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

threaded socket in MFC system service

Posted on 1999-09-24
4
Medium Priority
?
556 Views
Last Modified: 2013-11-20
I've got a problem with trying to use a CAsyncSocket in an MFC system service.  The service is coded as an EXE and currently being run in console mode (for debugging).

The problem I am having is that after I do my AfxSocketInit() I instantiate the socket as follows

   AfxSocketInit();

      CUDPSocket *m_pUDPSocket;
      m_pUDPSocket = new CUDPSocket;            //( this );
      m_pUDPSocket->Create( 2230, SOCK_DGRAM, FD_READ );
 
when I do the create I get the following assert/message Dialog

Microsoft Visual C++ Debug Libary
Debug Assertion Failed

Program myprogram.exe
File: afxwin1.inl
Line 19

press retry etc....

now, line 19 is the middle line of the following code

_AFXWIN_INLINE HINSTANCE AFXAPI AfxGetInstanceHandle()
{
LINE 19-> ASSERT(afxCurrentInstanceHandle != NULL);
      return afxCurrentInstanceHandle;
}


SO.  my question is obvious.  Whats going wrong here, why can't I create my socket?

any help would be appreciated.

thanks
0
Comment
Question by:SD_Adept
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 1

Author Comment

by:SD_Adept
ID: 2072378
Edited text of question.
0
 
LVL 4

Expert Comment

by:nil_dib
ID: 2072424
set some breakpoints and debug your application ...
0
 
LVL 23

Accepted Solution

by:
chensu earned 400 total points
ID: 2073009
To use MFC in a Win32 Console application, you must call AfxWinInit to initialize MFC. See

http://msdn.microsoft.com/library/devprods/vs6/visualc/vcmfc/_mfc_afxwininit.htm
0
 
LVL 1

Author Comment

by:SD_Adept
ID: 2073672
chensu, excellent, that worked perfectly.  thanks!


[Note to nil_dib for his comment.... geee, ya think?]
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

664 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question