org.apache.mina.io
Interface IoAcceptor

All Superinterfaces:
IoSessionManager, SessionManager
All Known Implementing Classes:
DatagramAcceptor, SocketAcceptor

public interface IoAcceptor
extends IoSessionManager

Accepts incoming connection, communicates with clients, and fires events to IoHandlers.

Please refer to EchoServer example.

You should bind to the desired socket address to accept incoming connections, and then events for incoming connections will be sent to the specified default IoHandler.

Threads accept incoming connections start automatically when bind(SocketAddress, IoHandler) is invoked, and stop when all addresses are unbound.

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

Method Summary
 void bind(SocketAddress address, IoHandler handler)
          Binds to the specified address and handles incoming connections with the specified handler.
 IoSession newSession(SocketAddress remoteAddress, SocketAddress localAddress)
          (Optional) Returns an IoSession that is bound to the specified localAddress and remoteAddress which reuses the localAddress that is already bound by IoAcceptor via bind(SocketAddress, IoHandler).
 void unbind(SocketAddress address)
          Unbinds from 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

bind

void bind(SocketAddress address,
          IoHandler handler)
          throws IOException
Binds to the specified address and handles incoming connections with the specified handler.

Throws:
IOException - if failed to bind

unbind

void unbind(SocketAddress address)
Unbinds from the specified address.


newSession

IoSession newSession(SocketAddress remoteAddress,
                     SocketAddress localAddress)
(Optional) Returns an IoSession that is bound to the specified localAddress and remoteAddress which reuses the localAddress that is already bound by IoAcceptor via bind(SocketAddress, IoHandler).

This operation is optional. Please throw UnsupportedOperationException if the transport type doesn't support this operation. This operation is usually implemented for connectionless transport types.

Throws:
UnsupportedOperationException - if this operation is not supported
IllegalArgumentException - if the specified localAddress is not bound yet. (see bind(SocketAddress, IoHandler))


Copyright © 2004-2005 . All Rights Reserved.