Yigal,

If the instrument is sending you data at a regular polled intervals then
use that as a "heartbeat".  If it gets more than 1.5 times past that
polling interval assume you have lost connection.

If the instrument does not send out data at a regular polled intervals
and as you said keep-alive or heartbeat can not be implemented then the
best you could do is reconnect after a fail safe time where you would
have assumed some communication would have occurred.

-Scott

-----Original Message-----
From: Rob Butler [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 15, 2007 9:42 AM
To: [email protected]
Subject: Re: How to get MINA to detect a lost connection?

Mina uses the handlers sessionClosed(...) to indicate the connection is
terminated.  That should get called if Mina gets a TCP FIN (connection
close) sent to it.

If your looking for more robust detection that is not possible.  The
connection will appear "normal" until you go to use it.  The data sent
over the connection could be either normal data or the keep-alive
messages.  The keep-alive messages just make sure the connection gets
used every so often.  This helps detect connection problems even if your
application is "idle".

This is not a limitation of Mina or Java.  C applications have the same
problem.

Rob

----- Original Message ----
From: Yigal Rachman <[EMAIL PROTECTED]>
To: [email protected]
Sent: Wednesday, August 15, 2007 12:47:22 PM
Subject: Re: How to get MINA to detect a lost connection?




  

Hi, Mat:



Thanks for your amazingly quick response!



DIRMINA-354
appears to refer to the issue of a "keep-alive" message, which is great
if both sides can cooperate on this.  My problem is that the instrument
uses a proprietory third-party protocol, over which I have no control. 
The instrument expects to be left alone while it is doing its job.



I was hoping that MINA has some way to detect the loss of the
connection, as happens with "normal" socket programming.



Yigal





mat wrote:

  https://issues.apache.org/jira/browse/DIRMINA-354

On 8/16/07, Yigal Rachman <[EMAIL PROTECTED]> wrote:
  
  
    Hi, Folks:

I have an instrument driver that is built on MINA.  During normal
operation, it does not write to the instrument, but just listens for
input from the instrument.  This part works flawlessly with very little
coding on my part (thanks to MINA).

There is one glitch: if the socket connection is ever lost, the driver
continues to think it is connected because MINA does not close the
session.

Any ideas how I can get this to work properly?

Thanks in advance,
Yigal Rachman

DMAS Data Acquisition Developer
NEPTUNE Canada
University of Victoria,
Victoria, BC, Canada
www.neptunecanada.ca





    
  
    









       
________________________________________________________________________
____________
Yahoo! oneSearch: Finally, mobile search 
that gives answers, not web links. 
http://mobile.yahoo.com/mobileweb/onesearch?refer=1ONXIC

Reply via email to