You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Uday Prakash (DHL CZ)" <ud...@dhl.com> on 2007/04/24 10:15:09 UTC

Checking if connectionb is alive.

Hi, 

I was looking thru some documentation online and realized that there is
no standard way [well, at least I didn't find any, may be I didn't look
hard enough or in the right place] to check if a tcp/ip connection is
alive between the server and client.

The reason I am posting is, to figure out if there is a clean way, from
the out side or inside the server to check if the connection is alive
between the server and client. This is so that I can have an indicator
on the gui representing the status of the connection.

Could anyone please direct me on this?

BTW: The Server I built on MINA performed beyond expectations, it was
needed to have a turnaround time of 70ms for message processing and
reply, I was able to get it done in 15ms!!!

Thank You,

-Uday 

RE: Checking if connectionb is alive.

Posted by Brigham Stevens <br...@vikingmind.com>.
I am using this:

           IoSession s = con.getIoSession();
            if(s.isConnected() && con.alive) {
                s.write(msg);
            }

Also my app sends Pings every 2 minutes, and I've set the idle timer to 2
minutes in sessionOpened, using session.setIdleTime, and use the idle
notification as an indicator something is wrong with that IoSession.


# -----Original Message-----
# From: Uday Prakash (DHL CZ) [mailto:uday.prakash@dhl.com] 
# Sent: Tuesday, April 24, 2007 1:15 AM
# To: dev@mina.apache.org
# Subject: Checking if connectionb is alive.
# 
# Hi, 
# 
# I was looking thru some documentation online and realized 
# that there is no standard way [well, at least I didn't find 
# any, may be I didn't look hard enough or in the right place] 
# to check if a tcp/ip connection is alive between the server 
# and client.
# 
# The reason I am posting is, to figure out if there is a clean 
# way, from the out side or inside the server to check if the 
# connection is alive between the server and client. This is so 
# that I can have an indicator on the gui representing the 
# status of the connection.
# 
# Could anyone please direct me on this?
# 
# BTW: The Server I built on MINA performed beyond 
# expectations, it was needed to have a turnaround time of 70ms 
# for message processing and reply, I was able to get it done in 15ms!!!
# 
# Thank You,
# 
# -Uday 


unsubscribe

Posted by 温 少 <sz...@hotmail.com>.
unsubscribe

_________________________________________________________________
享用世界上最大的电子邮件系统― MSN Hotmail。 http://www.hotmail.com 


Re: Checking if connectionb is alive.

Posted by Vinod Panicker <vi...@gmail.com>.
On 4/24/07, Uday Prakash (DHL CZ) <ud...@dhl.com> wrote:
> Hi,
>
> I also realized that the IoSession ifc, has a method isConnected(), this
> returns if the current session is connected to a remote peer. This is
> pretty useful and helpful.

That's exactly what I was referring to when I said "no reliable way".
isConnected() may return true and a write() to that session can still
fail because the session is actually disconnected.

Regards,
Vinod.

RE: Checking if connectionb is alive.

Posted by "Uday Prakash (DHL CZ)" <ud...@dhl.com>.
Hi, 

I also realized that the IoSession ifc, has a method isConnected(), this
returns if the current session is connected to a remote peer. This is
pretty useful and helpful.

Thank you for all your pointers,

-Uday 

-----Original Message-----
From: Vinod Panicker [mailto:vinod.p@gmail.com] 
Sent: Tuesday, April 24, 2007 10:37 AM
To: dev@mina.apache.org
Subject: Re: Checking if connectionb is alive.

On 4/24/07, Uday Prakash (DHL CZ) <ud...@dhl.com> wrote:
> Hi,
>
> I was looking thru some documentation online and realized that there
is
> no standard way [well, at least I didn't find any, may be I didn't
look
> hard enough or in the right place] to check if a tcp/ip connection is
> alive between the server and client.
>
> The reason I am posting is, to figure out if there is a clean way,
from
> the out side or inside the server to check if the connection is alive
> between the server and client. This is so that I can have an indicator
> on the gui representing the status of the connection.
>
> Could anyone please direct me on this?
>
> BTW: The Server I built on MINA performed beyond expectations, it was
> needed to have a turnaround time of 70ms for message processing and
> reply, I was able to get it done in 15ms!!!

Unfortunately, there's no reliable way of checking if a connection is
actually alive.  A standard practice is to send keep-alive packets
(implemented in your protocol) to ensure that the connection is kept
alive and working.

HTH,
Vinod.


Re: Checking if connectionb is alive.

Posted by Vinod Panicker <vi...@gmail.com>.
On 4/24/07, Uday Prakash (DHL CZ) <ud...@dhl.com> wrote:
> Hi,
>
> I was looking thru some documentation online and realized that there is
> no standard way [well, at least I didn't find any, may be I didn't look
> hard enough or in the right place] to check if a tcp/ip connection is
> alive between the server and client.
>
> The reason I am posting is, to figure out if there is a clean way, from
> the out side or inside the server to check if the connection is alive
> between the server and client. This is so that I can have an indicator
> on the gui representing the status of the connection.
>
> Could anyone please direct me on this?
>
> BTW: The Server I built on MINA performed beyond expectations, it was
> needed to have a turnaround time of 70ms for message processing and
> reply, I was able to get it done in 15ms!!!

Unfortunately, there's no reliable way of checking if a connection is
actually alive.  A standard practice is to send keep-alive packets
(implemented in your protocol) to ensure that the connection is kept
alive and working.

HTH,
Vinod.