[
https://issues.apache.org/jira/browse/DIRMINA-725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12731848#action_12731848
]
yujun zhu commented on DIRMINA-725:
-----------------------------------
/**
* 有新连接时触发,验证将在收到客户端消息之后做
*/
@Override
public void sessionOpened(IoSession ssn) throws Exception {
System.out.println("session open for " + ssn.getRemoteAddress());
}
/**
* 连接被关闭时触发
*/
@Override
public void sessionClosed(IoSession ssn) throws Exception {
System.out.println("session closed from " + ssn.getRemoteAddress());
}
/**
* 收到来自客户端的消息
* @throws Exception
*/
@Override
public void messageReceived(IoSession ssn, Object msgString) throws Exception{
String s = (String)msgString;
if(s.length()>1&&Msg.isJSONObject(s)){
JSONObject msgObject=JSONObject.fromObject(s);
System.out.println("Receive the Client'msg:"+msgObject);
MsgBroadCast.MsgSend( ssn, msgObject);
}
the above is the server code in my project(using mina 1.1.7).
When the project starts at the beginning,everything is normal.
session open for 58.129.47.21
Receive the Client'msg: XXXXXXXXXXX.
because I want to let the client keep connection(It is a chat system), session
is not closed.
but after a day or more time ,it happens as follow:
session open for 118.124.56.22
session closed from 118.124.56.22
the server can't receive the msg from the client. I am sure the client is not
closed automaticly.
I can't find the reason . I can't understand why the server is ok at the
beginning ,but after a long time ,the server can't receive the msg.
> why long connect is sessionClosed automaticly when client is not close
> initiatively?
> -------------------------------------------------------------------------------------
>
> Key: DIRMINA-725
> URL: https://issues.apache.org/jira/browse/DIRMINA-725
> Project: MINA
> Issue Type: Bug
> Affects Versions: 1.1.7
> Environment: windows+ MyEclipse
> Reporter: yujun zhu
> Fix For: 1.1.7
>
>
> 2516 [NioProcessor-1] INFO org.apache.mina.filter.logging.LoggingFilter -
> CREATED
> 2516 [NioProcessor-1] INFO org.apache.mina.filter.logging.LoggingFilter -
> OPENED
> session open for /127.0.0.1:3096
> 2532 [NioProcessor-1] INFO org.apache.mina.filter.logging.LoggingFilter -
> RECEIVED:
> 2828 [NioProcessor-1] INFO org.apache.mina.filter.logging.LoggingFilter - SENT
> 3453 [NioProcessor-2] INFO org.apache.mina.filter.logging.LoggingFilter -
> CREATED
> 3453 [NioProcessor-2] INFO org.apache.mina.filter.logging.LoggingFilter -
> OPENED
> session open for /127.0.0.1:3097
> 3453 [NioProcessor-2] INFO org.apache.mina.filter.logging.LoggingFilter -
> RECEIVED
> 3469 [NioProcessor-2] INFO org.apache.mina.filter.logging.LoggingFilter - SENT
> 4469 [NioProcessor-3] INFO org.apache.mina.filter.logging.LoggingFilter - SENT
> .....
> 10453 [NioProcessor-3] INFO org.apache.mina.filter.logging.LoggingFilter -
> CREATED
> 10453 [NioProcessor-3] INFO org.apache.mina.filter.logging.LoggingFilter -
> OPENED
> session open for /127.0.0.1:3104
> 10469 [NioProcessor-2] INFO org.apache.mina.filter.logging.LoggingFilter -
> CLOSED
> session closed from /127.0.0.1:3103
> 10469 [NioProcessor-1] INFO org.apache.mina.filter.logging.LoggingFilter -
> CLOSED
> 10469 [NioProcessor-3] INFO org.apache.mina.filter.logging.LoggingFilter -
> CLOSED
> 10469 [NioProcessor-3] INFO org.apache.mina.filter.logging.LoggingFilter -
> RECEIVED
> 10469 [NioProcessor-1] INFO org.apache.mina.filter.logging.LoggingFilter -
> CLOSED
> session closed from /127.0.0.1:3102
> why long connect is sessionClosed automaticly when client is not close
> initiatively?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.