public class ImageClient extends IoHandlerAdapter
ImageServer
限定符和类型 | 字段和说明 |
---|---|
static int |
CONNECT_TIMEOUT |
构造器和说明 |
---|
ImageClient(java.lang.String host,
int port,
ImageListener imageListener) |
限定符和类型 | 方法和说明 |
---|---|
void |
connect() |
void |
disconnect() |
void |
exceptionCaught(IoSession session,
java.lang.Throwable cause)
Invoked when any exception is thrown by user
IoHandler
implementation or by MINA. |
boolean |
isConnected() |
void |
messageReceived(IoSession session,
java.lang.Object message)
Invoked when a message is received.
|
void |
sendRequest(ImageRequest imageRequest) |
void |
sessionClosed(IoSession session)
Invoked when a connection is closed.
|
void |
sessionOpened(IoSession session)
Invoked when a connection has been opened.
|
inputClosed, messageSent, sessionCreated, sessionIdle
public static final int CONNECT_TIMEOUT
public ImageClient(java.lang.String host, int port, ImageListener imageListener)
public boolean isConnected()
public void connect()
public void disconnect()
public void sessionOpened(IoSession session) throws java.lang.Exception
IoHandlerAdapter
IoHandler.sessionCreated(IoSession)
. The biggest difference from
IoHandler.sessionCreated(IoSession)
is that it's invoked from other thread
than an I/O processor thread once thread model is configured properly.sessionOpened
在接口中 IoHandler
sessionOpened
在类中 IoHandlerAdapter
session
- The session being openedjava.lang.Exception
- If we get an exception while processing the open eventpublic void sessionClosed(IoSession session) throws java.lang.Exception
IoHandlerAdapter
sessionClosed
在接口中 IoHandler
sessionClosed
在类中 IoHandlerAdapter
session
- The session being closedjava.lang.Exception
- If we get an exception while processing the close eventpublic void sendRequest(ImageRequest imageRequest)
public void messageReceived(IoSession session, java.lang.Object message) throws java.lang.Exception
IoHandlerAdapter
messageReceived
在接口中 IoHandler
messageReceived
在类中 IoHandlerAdapter
session
- The session that is receiving a messagemessage
- The received messagejava.lang.Exception
- If we get an exception while processing the received messagepublic void exceptionCaught(IoSession session, java.lang.Throwable cause) throws java.lang.Exception
IoHandlerAdapter
IoHandler
implementation or by MINA. If cause
is an instance of
IOException
, MINA will close the connection automatically.exceptionCaught
在接口中 IoHandler
exceptionCaught
在类中 IoHandlerAdapter
session
- The session for which we have got an exceptioncause
- The exception that has been caughtjava.lang.Exception
- If we get an exception while processing the caught exception