Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.mina.common
Interface IoAcceptor

All Superinterfaces:
  IoService

All Known Implementing Classes:
  org.apache.mina.common.support.BaseIoAcceptor, DatagramAcceptor, org.apache.mina.common.support.DelegatedIoAcceptor, SocketAcceptor, VmPipeAcceptor

    public interface IoAcceptor

extends IoService

Accepts incoming connection, communicates with clients, and fires events to `IoHandler`s.

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: 555855 $, $Date: 2007-07-13 12:19:00 +0900 (Fri, 13 Jul 2007) $
Author:
  The Apache Directory Project (mina-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`.
`void` | `bind(SocketAddress address, IoHandler handler, IoServiceConfig config)` 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` and disconnects all clients connected there.
`void` | `unbindAll()` Unbinds all addresses which were bound by this acceptor.

Methods inherited from interface org.apache.mina.common.IoService
`addListener, getDefaultConfig, getFilterChain, getFilterChainBuilder, getManagedServiceAddresses, getManagedSessions, isManaged, removeListener, setFilterChainBuilder`

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

### bind

    void bind(SocketAddress address,
              IoHandler handler,
              IoServiceConfig config)
              throws IOException

  Binds to the specified `address` and handles incoming connections with the specified `handler`.

  Parameters:
    `config` - the configuration
  Throws:
    `IOException` - if failed to bind

### unbind

    void unbind(SocketAddress address)

  Unbinds from the specified `address` and disconnects all clients connected there.

### unbindAll

    void unbindAll()

  Unbinds all addresses which were bound by this acceptor.

### 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)`)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004-2008 Apache MINA Project. All Rights Reserved.