If you look at the main function in the activemq-cpp client given on our site I am just pasting it here now. It says.
HelloWorldProducer producer( 1000 ); HelloWorldConsumer consumer( 5000 ); // Start the consumer thread. Thread consumerThread( &consumer ); consumerThread.start(); // Start the producer thread. Thread producerThread( &producer ); producerThread.start(); // Wait for the threads to complete. producerThread.join(); consumerThread.join(); When I debug the call goes to connection = connectionFactory->createConnection(); // inside HelloWorldConsumer.cpp and HelloWorldProducer.cpp It runs this piece of code in turn ... if( status < 0 ){ close(); throw SocketException( __FILE__, __LINE__, "Socket::connect - %s", ::strerror( errno ) ); } and throws the exception ... from the class tcpsocket.cpp Bish, Tim wrote: > >> >> The following piece of code in the class SocketFactory.cpp is throwing >> exceptions .... >> BufferedSocket* socket = new BufferedSocket(tcpSocket, >> inputBufferSize, outputBufferSize); >> socket->connect( host.c_str(), port ); >> >> it returns an invalid handle actually. I can see the call coming in > twice >> to >> this piece of code (producer and then the consumer ... both are > threaded >> and >> do a join inside the main method). The second time the call comes in > it >> bombs. > > It shouldn't be calling the socket factory twice, especially not from > producer and consumer as they have nothing to do with the sockets. > > What code are you trying to run? Example? > > If you run from a command window, what is the error that is printed out? > >> >> Cant understand why this is happening ... any ideas on what could be > the >> reason. >> I tried changing the port to 61614 for the broker and the code in the >> client >> too ... did not work still ... same probs. >> >> Any hint would be really useful. >> -- >> View this message in context: http://www.nabble.com/Sockets-not- >> connecting-...-Invalid-handle-returned-tf2225941.html#a6168387 >> Sent from the ActiveMQ - User forum at Nabble.com. > > > -- View this message in context: http://www.nabble.com/Sockets-not-connecting-...-Invalid-handle-returned-tf2225941.html#a6171212 Sent from the ActiveMQ - User forum at Nabble.com.