public interface IoConnector extends IoService
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.
Modifier and Type | Method and Description |
---|---|
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() |
SocketAddress |
getDefaultLocalAddress() |
SocketAddress |
getDefaultRemoteAddress() |
void |
setConnectTimeout(int connectTimeout)
Deprecated.
|
void |
setConnectTimeoutMillis(long connectTimeoutInMillis)
Sets the connect timeout in milliseconds.
|
void |
setDefaultLocalAddress(SocketAddress defaultLocalAddress)
Sets the default local address
|
void |
setDefaultRemoteAddress(SocketAddress defaultRemoteAddress)
Sets the default remote address to connect to when no argument is
specified in
connect() method. |
addListener, broadcast, dispose, dispose, getActivationTime, getFilterChain, getFilterChainBuilder, getHandler, getManagedSessionCount, getManagedSessions, getScheduledWriteBytes, getScheduledWriteMessages, getSessionConfig, getSessionDataStructureFactory, getStatistics, getTransportMetadata, isActive, isDisposed, isDisposing, removeListener, setFilterChainBuilder, setHandler, setSessionDataStructureFactory
@Deprecated int getConnectTimeout()
long getConnectTimeoutMillis()
@Deprecated void setConnectTimeout(int connectTimeout)
connectTimeout
- The time out for the connectionvoid setConnectTimeoutMillis(long connectTimeoutInMillis)
connectTimeoutInMillis
- The time out for the connectionSocketAddress getDefaultRemoteAddress()
connect()
method.void setDefaultRemoteAddress(SocketAddress defaultRemoteAddress)
connect()
method.defaultRemoteAddress
- The default remote addressSocketAddress getDefaultLocalAddress()
void setDefaultLocalAddress(SocketAddress defaultLocalAddress)
defaultLocalAddress
- The default local addressConnectFuture connect()
default
remote address
.ConnectFuture
instance which is completed when the
connection attempt initiated by this call succeeds or fails.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 createdConnectFuture
instance which is completed when the
connection attempt initiated by this call succeeds or fails.IllegalStateException
- if no default remote address is set.ConnectFuture connect(SocketAddress remoteAddress)
remoteAddress
- The remote address to connect toConnectFuture
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 createdConnectFuture
instance which is completed when the
connection attempt initiated by this call succeeds or fails.ConnectFuture connect(SocketAddress remoteAddress, SocketAddress localAddress)
remoteAddress
- The remote address to connectlocalAddress
- The local address to bindConnectFuture
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 createdConnectFuture
instance which is completed when the
connection attempt initiated by this call succeeds or fails.Copyright © 2004–2018 Apache MINA Project. All rights reserved.