Home  >  Article  >  Backend Development  >  Apache Mina study notes (7) - Handler

Apache Mina study notes (7) - Handler

黄舟
黄舟Original
2017-01-18 10:14:301307browse

IoHandler has the following functions:

sessionCreated
sessionOpened
sessionClosed
sessionIdle
exceptionCaught
messageReceived
messageSent

sessionCreated Event


The Session Created event occurs when a connection is created. For TCP, the result is that the connection is accepted, and for UDP, the UDP packet is accepted. This function can be used to initialize session parameters.

sessionOpened Event

The session opened event occurs when a connection is opened. It is always called after the sessionCreated event. If a thread model is configured, then this function is called in that thread instead of 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 for the UDP protocol.

exceptionCaught 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 notes (7) - Handler, more For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn