org.apache.mina.io
Interface IoConnector

All Superinterfaces:
IoSessionManager, SessionManager
All Known Implementing Classes:
DatagramConnector, SocketConnector

public interface IoConnector
extends IoSessionManager

Connects to endpoint, communicates with the server, and fires events to IoHandlers.

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, IoHandler) is invoked, and stop when all connection attempts are finished.

Version:
$Rev: 332218 $, $Date: 2005-11-10 12:52:42 +0900 $
Author:
The Apache Directory Project (dev@directory.apache.org)

Method Summary
 IoSession connect(SocketAddress address, int timeout, IoHandler handler)
          Connects to the specified address with timeout.
 IoSession connect(SocketAddress address, IoHandler handler)
          Connects to the specified address.
 IoSession connect(SocketAddress address, SocketAddress localAddress, int timeout, IoHandler handler)
          Connects to the specified address with timeout.
 IoSession connect(SocketAddress address, SocketAddress localAddress, IoHandler handler)
          Connects to the specified address.
 
Methods inherited from interface org.apache.mina.io.IoSessionManager
getFilterChain
 
Methods inherited from interface org.apache.mina.common.SessionManager
getExceptionMonitor, setExceptionMonitor
 

Method Detail

connect

IoSession connect(SocketAddress address,
                  IoHandler handler)
                  throws IOException
Connects to the specified address. If communication starts successfully, events are fired to the specified handler. This method blocks.

Throws:
IOException - if failed to connect

connect

IoSession connect(SocketAddress address,
                  SocketAddress localAddress,
                  IoHandler handler)
                  throws IOException
Connects to the specified address. If communication starts successfully, events are fired to the specified handler. This method blocks.

Parameters:
localAddress - the local address the channel is bound to
Throws:
IOException - if failed to connect

connect

IoSession connect(SocketAddress address,
                  int timeout,
                  IoHandler handler)
                  throws IOException
Connects to the specified address with timeout. If communication starts successfully, events are fired to the specified handler. This method blocks.

Throws:
IOException - if failed to connect

connect

IoSession connect(SocketAddress address,
                  SocketAddress localAddress,
                  int timeout,
                  IoHandler handler)
                  throws IOException
Connects to the specified address with timeout. If communication starts successfully, events are fired to the specified handler. This method blocks.

Parameters:
localAddress - the local address the channel is bound to
Throws:
IOException - if failed to connect


Copyright © 2004-2005 . All Rights Reserved.