I am not sure if I understand your issue, but I would like to share my opinion 
with you about it:

First of all, Mina is suitable for both long-term and short-term connection 
oriented programming. Long-term connections means lifetime of the connection 
will last from begin to end, usually the communication protocol should has 
operations that responsible for session create, session keepalive, session 
close. On the other hand, short-term connections, just like http connections, 
created before http request is issued, till received corresponding http 
response. (But for the purpose of performance, most programmer choose to open 
keep-alive option to maintain the http connection between client and server).

Second, network related exceptions really exists during the communication 
phase, no matter what kind of connection manner you adoptm, so MINA provides 
exception listener method to allow programmers to process exception condition 
and recovery from it. Limited-retry , forget and continue are most popular 
approaches to handle such cases.

Finally, MINA is java-based network programming framework in nature, there is 
no way to know whether computer system is waken up from sleep mode. So I 
suggest the method to deal with connection invalid case is just encapsulate 
your source code to detect network io exceptions and try to resend your 
information again.

BTW, you mentioned that you connection maybe last for about 10 minutes, 
therefore I guess that program written by you is towards long-term connection, 
so please also adopt heart-beat detection mechanism inside you software.

Best Regards
Anderson Guo

-----Original Message-----
From: Allen Jiang [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 11, 2008 1:17 PM
To: [email protected]
Subject: Re: About the time limit of connection keeps valid from standby mode

Hi,李 翠竹,
   Maybe you could check whether you have set the session to be closed when the 
session's idle event is activated in your server  site.

Yahoo ID:allen_jiangguilong 

----- Original Message -----
From: "李 翠竹" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, September 11, 2008 9:48 AM
Subject: About the time limit of connection keeps valid from standby mode


> 
> Hi,
> I found the mina connection sometimes keeps valid, but sometimes goes invalid 
> after the computer resumes from standby mode. 
> My test case is like this:
> OS:Microsoft Windows XP,Professional,Version 2002,Service Pack 2
> Mina version:2.0.0-M1
> Step:
> 1)My client program creates a connection to a server by using SocketConnector.
> 2)The computer on which my client program runs enters standby mode and the 
> active connections are disconnected.
> 3)Bring the computer out of standby mode after a time.
> I found the connection would be valid or invalid, according to the standby 
> time.
> If standby time is less than a period time(about 10 minutes), the connection 
> still keeps valid and can send /receive datas.
> Else, the connection goes invalid and gets the fllowing exception when it 
> attempt to send datas.
> java.io.IOException: An existing connection was forcibly closed by the remote 
> host.
> 
> I want to learn:
> 1)How to calculate the time limit (about 10 minutes in my case) after which 
> the connection become invalid in windows standby mode?
> 2)Could I set this time limit?
> 
> Thanks,
> Li
> 
> _________________________________________________________________
> 秋本番!�B休たくさんのこの秋、みんなのオススメ�L末旅行をチェックしよう
> http://clk.atdmt.com/GBL/go/112813570/direct/01/

Reply via email to