CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Threaded View

  1. #1
    Join Date
    Nov 2008
    Location
    Cebu, Philippines
    Posts
    19

    Question ASSERT(m_hSocket == INVALID_SOCKET) Error

    Hello MFC networking gurus. i'm having some trouble in my program. It generates an access violation runtime error and when i debug it, it points to the assertion in the title.

    it's a client based CSocket Application where all i did was follow the normal flow.
    1. AfxSocketInit()
    2. CreateSocket();
    3. Connect();

    the error occurs in the create part.

    a little detailed design of the program is:
    Code:
    class CSockMgrDLGDlg : public CDialog
    {
       //other functions and attributes
      private:
          CommunicationMgr *oComMgr;
    };
    
    class CommunicationMgr
    {
        //other functions and attributes
        private:
            CSocketMgr  *oSocketMgr;
    }
    
    class CSocketMgr : public CSocket
    {
        //some functions and attributes
    };
    CSockMgrDLGDlg uses CommunicationMgr for connectivity. CSockMgrDLGDlg calls the CommunicationMgr::Connect() function
    and CommunicationMgr::Connect calls CSocket::Connect() that goes for XXX::Create() too.



    Question:
    1. what do you think are the possible reasons that this access violation error is occurring?
    2. will there be some hidden bugs/runtime errors created if CSockMgrDLGDlg doesn't use CSocketMgr directly?

    thank you very much in advance..
    Last edited by klambiguit; November 12th, 2008 at 05:17 AM. Reason: added details..

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