CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Nov 2000
    Posts
    1

    ASSERT(pState->m_hSocketWindow != NULL)

    I'm using CSockets. Somethimes when I'm using my application (simple POP3-SMTP mailer) I got a Debug Assertion Error in sockcore.cpp line 851...
    This is PumpMessages function and line is...
    ASSERT(pState->m_hSocketWindow != NULL);

    Does anyone know where's the problem...
    I think that beta MFC patch mfc42b isn't the solution...


  2. #2
    Join Date
    Jan 2000
    Location
    Las Vegas, NV, USA
    Posts
    470

    Re: ASSERT(pState->m_hSocketWindow != NULL)

    Can you be more specific? My crystal ball won't work today because of increased EM radiation.

    Under what circumstances does this occur? On what kind of socket? Do you create sockets dynamically? Are sockets always associated with a valid window? Is the error reproducible, or does it appear to be non-deterministic?

    Frankly, I don't believe it is an MFC bug. If it was, someone else would have probably stumbled upon it. Chances are that there is something in your code that makes it choke.

    -n


  3. #3
    Join Date
    May 2003
    Location
    Pakistan
    Posts
    223

    Re: ASSERT(pState->m_hSocketWindow != NULL)

    Originally posted by BBKhan
    I'm using CSockets. Somethimes when I'm using my application (simple POP3-SMTP mailer) I got a Debug Assertion Error in sockcore.cpp line 851...
    This is PumpMessages function and line is...
    ASSERT(pState->m_hSocketWindow != NULL);

    Does anyone know where's the problem...
    I think that beta MFC patch mfc42b isn't the solution...

    probably u r using CSocket inside some other thread. If u r doing it , it is not very simple. i expain if u confirm it.

    but for just checking run ure program with static library and release mode.

  4. #4
    Join Date
    Mar 2006
    Posts
    2

    Re: ASSERT(pState->m_hSocketWindow != NULL)

    Quote Originally Posted by atif_ilm
    probably u r using CSocket inside some other thread. If u r doing it , it is not very simple. i expain if u confirm it.

    but for just checking run ure program with static library and release mode.
    i m facing same problem ...and i m using some other thread in the CSocket.....would u tell me the solution?

  5. #5
    Join Date
    May 2003
    Location
    Pakistan
    Posts
    223

    Re: ASSERT(pState->m_hSocketWindow != NULL)

    hmmmmm I faced this problem long time ago , but le me recollect it.

    yeh do the following things.

    1. If u r using VS6.0 install Visual Studio Service Pakc 6 or Higer.
    2. In the main thread accept the new connection, this will
    give u a new CSocket object. Detach the socket handle from this
    socket. Start new thread in suspended mode. Then assign this
    detached socket handle to some member varibale of thread object.
    then Resume the thread. In the InitInstance of ure new thread attach
    that sockt handle to some member variable socket. And use this new socket for further communication.


    2nd Point is just to make the whole process more safer.

    and the last advice dont use MFC sockets, MFC is bull **** stuff. Buggy and slow. Instead of it use WINSOCK API, those are quite fast and less buggy.
    Unmanaged in a .NET world

  6. #6
    Join Date
    Jul 2005
    Location
    Germany
    Posts
    1,194

    Red face Re: ASSERT(pState->m_hSocketWindow != NULL)

    Quote Originally Posted by atif_ilm
    and the last advice dont use MFC sockets, MFC is bull **** stuff. Buggy and slow. Instead of it use WINSOCK API, those are quite fast and less buggy.
    I completely agree. Use Winsock API. It is very good IMHO.
    Please don't forget to rate users who helped you!

  7. #7
    Join Date
    Mar 2006
    Posts
    2

    Re: ASSERT(pState->m_hSocketWindow != NULL)

    Thanks for your reply.
    I am facing this problem in client side......would you tell me ur suggestion...


    Quote Originally Posted by atif_ilm
    hmmmmm I faced this problem long time ago , but le me recollect it.

    yeh do the following things.

    1. If u r using VS6.0 install Visual Studio Service Pakc 6 or Higer.
    2. In the main thread accept the new connection, this will
    give u a new CSocket object. Detach the socket handle from this
    socket. Start new thread in suspended mode. Then assign this
    detached socket handle to some member varibale of thread object.
    then Resume the thread. In the InitInstance of ure new thread attach
    that sockt handle to some member variable socket. And use this new socket for further communication.


    2nd Point is just to make the whole process more safer.

    and the last advice dont use MFC sockets, MFC is bull **** stuff. Buggy and slow. Instead of it use WINSOCK API, those are quite fast and less buggy.

  8. #8
    Join Date
    May 2003
    Location
    Pakistan
    Posts
    223

    Re: ASSERT(pState->m_hSocketWindow != NULL)

    Install Visual Studio Service Pack 6 or Higer, if u have VS6.0 otherwise use Visual Studio .NET.
    Unmanaged in a .NET world

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured