When a connection is created, the SessionCreated event occurs. For TCP, the result is connection acceptance, and for UDP, UDP data packets are accepted. This function can be used to initialize the session parameter. IoHandler has the following functions:
SessionCreatedsessionOpenedsessionClosedsessionIdleexceptionCaughtmessageReceivedmessageSent
SessionCreated Event
When a connection is Created, the Session Created event occurs. For TCP, the result is connection acceptance, and for UDP, UDP data packets are accepted. This function can be used to initialize the session parameter.
SessionOpened Event
When a connection is opened, the session opened event occurs. It is always called after the sessionCreated event. If a thread model is configured, this function is called in this thread instead of being called in the I/O processing thread.
SessionClosed Event
This event occurs when a session is closed.
Sessionidle Event
This event occurs when a session is idle, but this function does not work with UDP.
Predictioncaught Event
This function is called when an Exception is thrown.
MessageReceived Event
This event occurs when a message arrives.
MessageSent Event
This event occurs when sending, such as calling IoSession. write ().
The above is the content of Apache Mina study note (7)-Handler. For more information, see PHP Chinese website (www.php1.cn )!