Hi,

I have a piece of code that looks like this:

if (myTCPStream->isPending(Socket::pendingInput, myTimeout)) {
       myTCPStream->read((char *) theBuffer, theLength);
    }
    else {
        throw ConnectionIOException(new string("Timeout"), ConnectionIOException::TIMEOUT);
    }
   
   

   int err = myTCPStream->getErrorNumber();
   //TODO
   //for now check for error, if error throw exception
   //not sure why read does not throw exception on timeout?
   if (err != Socket::errSuccess) {
      switch (err) {
         case Socket::errTimeout: {
               throw ConnectionIOException(new string(myTCPStream->getErrorString()), ConnectionIOException::TIMEOUT);
            }
         default: {

               throw ConnectionIOException(new string(myTCPStream->getErrorString()), ConnectionIOException::GENERAL);
            }
      }

   }

I wrote it like this because an exception was not being thrown on a socket timeout. I then compiled this same code on another machine, and an exception was thrown upon socket timeout! What would cause this difference in behavior and how can I fix it?

Thanks,

Adam