activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kevinba <kevin.ba...@itssiemens.com>
Subject RE: Help running CPP Example
Date Wed, 19 Jul 2006 14:21:38 GMT

So did you check in a patch for the disconnect problem.  What is happening? 
I notice the exception that causes it to disconnect says something about "a
connection attempt failed because the connected party did not properly
respond after a period of time, or ..."


I have a question.

the function   

void IOTransport::run(){


Looks like it just loops until the "closed" variable is set.  After it but
somewhere in the reader->readCommand it should be blocked until the next
incoming message is recevied correct?

int SocketInputStream::read( unsigned char* buffer, const int bufferSize )
throw (IOException){


Finally inside the ::read statement the  

int bytesAvailable = available();



I'm I following this correctly.

When you start and do a connection it loops through now and makes the
connection, but it immediatlly loops again even though nothing is expected. 
in the methond  IOTransport::run() there is a call for  available =
inputStream->available();  This return 1.  So it tries to attempt to read
again.


When it gets to bytesAvailable = availabe();  it immediately returns with a
value of 0.

so then you go into the 

int len = ::recv(socket, (char*)buffer, bufferSize, 0);

when return timed out because there is nothing waiting on the line.  

But the whole problem steams from the initial CONNECTED message that was
received.  You received 72 bytes but when you go through the second loop in
IOTransport::run()  it calls available = inputStream->available(); to see if
there is anything else pending.  it return 1 but not from the
SocketInputStream::available() call that is done.  

The real problem is the (tail-head)  are not 0.  Tail is 72 and head is 71. 
This is what returns the 1 that tells it there is pending message and which
causes the timeout because there is nothing there.  The original message is
not processed propperly.





-- 
View this message in context: http://www.nabble.com/Help-running-CPP-Example-tf1957518.html#a5397170
Sent from the ActiveMQ - User forum at Nabble.com.


Mime
View raw message