Holger's Java API

## com.antelmann.net
Class NetConnectionServer.DefaultDispatcher

    java.lang.Object
      com.antelmann.net.NetConnectionServer.DefaultDispatcher

All Implemented Interfaces:
  ConnectionDispatcher

Enclosing class:
  NetConnectionServer

    public static class NetConnectionServer.DefaultDispatcher

extends Object
implements ConnectionDispatcher

The DefaultDispatcher provides a default ConnectionDispatcher that is used when the NetConnectionServer constructor in the enclosing class is called with a NetConnectionHandler

Constructor Summary
`NetConnectionServer.DefaultDispatcher(NetConnectionHandler handler, Handshake handshake)`
`NetConnectionServer.DefaultDispatcher(NetConnectionHandler handler, Handshake handshake, Logger logger)`

Method Summary
`NetConnection` `createConnection(Socket socket)` simply returns SocketConnection.createServerConnection(socket, handshake)
`MessageDelegator` `createDispatcher(NetConnection con, NetConnectionHandler handler)` responsible for creating the delegator based on the created connection and the associated handler
`NetConnectionHandler` `createHandler(NetConnection con)` uses the same handler (given in the constructor) for all connections
`Handshake` `getHandshake()` returns the Handshake given in the constructor

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### NetConnectionServer.DefaultDispatcher

    public NetConnectionServer.DefaultDispatcher(NetConnectionHandler handler,
                                                 Handshake handshake)

### NetConnectionServer.DefaultDispatcher

    public NetConnectionServer.DefaultDispatcher(NetConnectionHandler handler,
                                                 Handshake handshake,
                                                 Logger logger)

Method Detail

### createConnection

    public NetConnection createConnection(Socket socket)
                                   throws IOException

  simply returns SocketConnection.createServerConnection(socket, handshake)

  Specified by:
    `createConnection` in interface `ConnectionDispatcher`
  Throws:
    `IOException`
  See Also:
    `SocketConnection.createServerConnection(Socket, Handshake)`

### createHandler

    public NetConnectionHandler createHandler(NetConnection con)

  uses the same handler (given in the constructor) for all connections

  Specified by:
    `createHandler` in interface `ConnectionDispatcher`
  See Also:
    `MessageDelegator`

### getHandshake

    public Handshake getHandshake()

  returns the Handshake given in the constructor

  Specified by:
    `getHandshake` in interface `ConnectionDispatcher`

### createDispatcher

    public MessageDelegator createDispatcher(NetConnection con,
                                             NetConnectionHandler handler)

  Description copied from interface: `ConnectionDispatcher`
  responsible for creating the delegator based on the created connection and the associated handler

  Specified by:
    `createDispatcher` in interface `ConnectionDispatcher`

(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads