|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IoConnector
Connects to endpoint, communicates with the server, and fires events to
IoHandler
s.
Please refer to NetCat example.
You should connect to the desired socket address to start communication,
and then events for incoming connections will be sent to the specified
default IoHandler
.
Threads connect to endpoint start automatically when
connect(SocketAddress)
is invoked, and stop when all
connection attempts are finished.
Method Summary | |
---|---|
ConnectFuture |
connect()
Connects to the default remote address . |
ConnectFuture |
connect(IoSessionInitializer<? extends ConnectFuture> sessionInitializer)
Connects to the default
remote address and invokes the ioSessionInitializer when
the IoSession is created but before IoHandler.sessionCreated(IoSession)
is invoked. |
ConnectFuture |
connect(SocketAddress remoteAddress)
Connects to the specified remote address. |
ConnectFuture |
connect(SocketAddress remoteAddress,
IoSessionInitializer<? extends ConnectFuture> sessionInitializer)
Connects to the specified remote address and invokes the ioSessionInitializer when the IoSession is created but before
IoHandler.sessionCreated(IoSession) is invoked. |
ConnectFuture |
connect(SocketAddress remoteAddress,
SocketAddress localAddress)
Connects to the specified remote address binding to the specified local address. |
ConnectFuture |
connect(SocketAddress remoteAddress,
SocketAddress localAddress,
IoSessionInitializer<? extends ConnectFuture> sessionInitializer)
Connects to the specified remote address binding to the specified local address and and invokes the ioSessionInitializer when the
IoSession is created but before IoHandler.sessionCreated(IoSession)
is invoked. |
int |
getConnectTimeout()
Deprecated. |
long |
getConnectTimeoutMillis()
Returns the connect timeout in milliseconds. |
SocketAddress |
getDefaultRemoteAddress()
Returns the default remote address to connect to when no argument is specified in connect() method. |
void |
setConnectTimeout(int connectTimeout)
Deprecated. |
void |
setConnectTimeoutMillis(long connectTimeoutInMillis)
Sets the connect timeout in milliseconds. |
void |
setDefaultRemoteAddress(SocketAddress defaultRemoteAddress)
Sets the default remote address to connect to when no argument is specified in connect() method. |
Methods inherited from interface org.apache.mina.core.service.IoService |
---|
addListener, broadcast, dispose, getActivationTime, getFilterChain, getFilterChainBuilder, getHandler, getIdleState, getManagedSessionCount, getManagedSessions, getScheduledWriteBytes, getScheduledWriteMessages, getSessionConfig, getSessionDataStructureFactory, getStatistics, getTransportMetadata, isActive, isDisposed, isDisposing, removeListener, setFilterChainBuilder, setHandler, setSessionDataStructureFactory |
Method Detail |
---|
int getConnectTimeout()
getConnectTimeoutMillis()
long getConnectTimeoutMillis()
void setConnectTimeout(int connectTimeout)
setConnectTimeoutMillis()
void setConnectTimeoutMillis(long connectTimeoutInMillis)
SocketAddress getDefaultRemoteAddress()
connect()
method.
void setDefaultRemoteAddress(SocketAddress defaultRemoteAddress)
connect()
method.
ConnectFuture connect()
default remote address
.
IllegalStateException
- if no default remoted address is set.ConnectFuture connect(IoSessionInitializer<? extends ConnectFuture> sessionInitializer)
default
remote address
and invokes the ioSessionInitializer
when
the IoSession is created but before IoHandler.sessionCreated(IoSession)
is invoked. There is no guarantee that the ioSessionInitializer
will be invoked before this method returns.
sessionInitializer
- the callback to invoke when the IoSession
object is created
IllegalStateException
- if no default remote address is set.ConnectFuture connect(SocketAddress remoteAddress)
ConnectFuture
instance which is completed when the
connection attempt initiated by this call succeeds or fails.ConnectFuture connect(SocketAddress remoteAddress, IoSessionInitializer<? extends ConnectFuture> sessionInitializer)
ioSessionInitializer
when the IoSession is created but before
IoHandler.sessionCreated(IoSession)
is invoked. There is no
guarantee that the ioSessionInitializer
will be invoked before
this method returns.
remoteAddress
- the remote address to connect tosessionInitializer
- the callback to invoke when the IoSession
object is created
ConnectFuture
instance which is completed when the
connection attempt initiated by this call succeeds or fails.ConnectFuture connect(SocketAddress remoteAddress, SocketAddress localAddress)
ConnectFuture
instance which is completed when the
connection attempt initiated by this call succeeds or fails.ConnectFuture connect(SocketAddress remoteAddress, SocketAddress localAddress, IoSessionInitializer<? extends ConnectFuture> sessionInitializer)
ioSessionInitializer
when the
IoSession is created but before IoHandler.sessionCreated(IoSession)
is invoked. There is no guarantee that the ioSessionInitializer
will be invoked before this method returns.
remoteAddress
- the remote address to connect tolocalAddress
- the local interface to bind tosessionInitializer
- the callback to invoke when the IoSession
object is created
ConnectFuture
instance which is completed when the
connection attempt initiated by this call succeeds or fails.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |