public class ChatProtocolHandler extends IoHandlerAdapter
IoHandler
implementation of a simple chat server protocol.构造器和说明 |
---|
ChatProtocolHandler() |
限定符和类型 | 方法和说明 |
---|---|
void |
broadcast(java.lang.String message) |
void |
exceptionCaught(IoSession session,
java.lang.Throwable cause)
Invoked when any exception is thrown by user
IoHandler
implementation or by MINA. |
int |
getNumberOfUsers() |
boolean |
isChatUser(java.lang.String name) |
void |
kick(java.lang.String name) |
void |
messageReceived(IoSession session,
java.lang.Object message)
Invoked when a message is received.
|
void |
sessionClosed(IoSession session)
Invoked when a connection is closed.
|
messageSent, sessionCreated, sessionIdle, sessionOpened
public void exceptionCaught(IoSession session, java.lang.Throwable cause)
IoHandler
IoHandler
implementation or by MINA. If cause
is instanceof
IOException
, MINA will close the connection automatically.exceptionCaught
在接口中 IoHandler
exceptionCaught
在类中 IoHandlerAdapter
public void messageReceived(IoSession session, java.lang.Object message)
IoHandler
messageReceived
在接口中 IoHandler
messageReceived
在类中 IoHandlerAdapter
public void broadcast(java.lang.String message)
public void sessionClosed(IoSession session) throws java.lang.Exception
IoHandler
sessionClosed
在接口中 IoHandler
sessionClosed
在类中 IoHandlerAdapter
java.lang.Exception
public boolean isChatUser(java.lang.String name)
public int getNumberOfUsers()
public void kick(java.lang.String name)