Menu

can't instanciate TCPSession under Win32

Anonymous
2001-05-24
2001-05-31
  • Anonymous

    Anonymous - 2001-05-24

    Hello,

    VC6.0 SP5.
    When I try to instanciate a class derived from TCPSession, an exception is raised :
    Unhandled exception in essai.cpp (MSVCIRTD.dll): 0xC0000005 : Access Violation.
    this exception appears when the istream constructor is called ?

    Have someone already faced this problem ?

    Regards,

    Jean.

     
    • Ville Vainio

      Ville Vainio - 2001-05-28

      I can't remember whether I had similar problems, but I do (seem to) know that you can't use both old-style streams (#include <iostream.h>, the kind used by Common C++) and new style streams (#include <iostream>, the kind that resides in the std namespace) in the same program. Maybe this is the cause of your problem?

       
      • Anonymous

        Anonymous - 2001-05-28

        Thanks,

        in order to avoid crashes, i didn't use the <iostream>, as <iostream.h> is already used by the cc++ lib.
        Nevertheless, the problem was still there, and it could be explained by a memory allocation issue within DLLs under Win32.

        So i tried to replace <iostream.h> by <iostream> in the cc++ code (and modified some lines), and then recompile the lib. It seems to work, although i have to make further investigations.

        If someone needs it, i'll post my modifications as soon as i'm finished with the tests.

         
        • Ville Vainio

          Ville Vainio - 2001-05-29

          What about <fstream>? It quite probably screws things up as well.

          About the porting to new stream libs - I would be interested if your changes work. A colleague tried something similar, but std::iostream didn't seem to have a default constructor and things got more complicated... I hope std::iostream will be used in the future, at least in the win32 tree, or a simpler, non-stream-inheriting TCP class will be implemented, as I suggested in the feature request section.

           
          • Anonymous

            Anonymous - 2001-05-31

            Along with the above modifications, I also tried to make 2 new classes by copying the TCPStream and TCPSession code, and then removing the iostream and streambuf inheritance.
            Unfortunately, the "TCPSession-like" class didn't work, as the data sent into the socket weren't what excepted. On the contrary, the "TCPStream-like" class worked perfectly.

            So I try to debug the TCPSession, and I maybe found a small error in its constructors : in the following lines, the Win32 part does not seem to be fully equivalent to the non-Win32 one.
            #ifdef WIN32
              if(WSAGetLastError() == WSAEWOULDBLOCK)
            #else
              if(errno == EINPROGRESS)
            #endif

            I corrected by writting :
            if(WSAGetLastError() == WSAEISCONN)

            OK, I'm not sure this correction is the right one, but the "if" clause is now entered.
            The next step is now to verify if the reason for the problems with the TCPSession is the <iostream> issue or the constructor code.

            At last, could you explain me how to post corrections to the projects ?

             
        • David Sugar

          David Sugar - 2001-05-30

          I would like to see if we can add this for the next release also...

           

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.