Menu

tcpstream()

Help
2000-03-21
2000-04-14
  • Olle Hedman

    Olle Hedman - 2000-03-21

    Hi.

    I am haveing trubble with the tcpstream() constructor and/or the operator! function.

    What I'm doing is simply this:

    tcpstream server;  // should create an unopened tcpstream

    while(!server) {    // while not open
      server.open(servers.get());   // try to open
    }

    where servers is a class with a circular linked list of servers.
    But it never gets to the server.open() part.
    if I remove the ! it gets stuck in the while.
    It looks to me that it thinks the tcpstream is open when I created it with no parameters.

    Or is it just me being stupid?

    //Olle

     
    • David Sugar

      David Sugar - 2000-03-22

      In the socket.h header, under class tcpstream, replace:

      inline bool operator!()
          {return Socket::state == SOCKET_INITIAL;};

      with

      inline bool operator!()
          {return Socket::state != SOCKET_CONNECTED;};

      This should produce the behavior you are looking for and should be
      changed by the next release.

       
      • Olle Hedman

        Olle Hedman - 2000-03-22

        Thank you, that worked fine.

        It's a really nice library you've got there, keep up the good work!

         
      • Olle Hedman

        Olle Hedman - 2000-04-13

        Hey.  I upgraded to 0.9.5 today and I noticed that you have written

        inline bool operator!()
                            {return Socket::state == SOCKET_CONNECTED;};
        instead of
        inline bool operator!()
                            {return Socket::state != SOCKET_CONNECTED;};
        as it should be..  this error is in 0.9.4 too..  

         
        • David Sugar

          David Sugar - 2000-04-14

          You are correct...oops!

           

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.