com.kuka.comm.net
Class UdpConnectionHandler

java.lang.Object
  extended by com.kuka.comm.net.NetConnectionHandler<UdpServer,UdpConnection,DatagramPacket>
      extended by com.kuka.comm.net.UdpConnectionHandler

public class UdpConnectionHandler
extends NetConnectionHandler<UdpServer,UdpConnection,DatagramPacket>

This class is responsible for handling incoming connection requests at a UDP server.

Override #acceptConnection(UdpServer, DatagramPacket) to decide whether an incoming request is accepted. The default implementation accepts all requests.


Constructor Summary
UdpConnectionHandler(NetConnectionConfigurator<UdpConnection> configurator)
          Creates a new UDP connection handler that accepts an unlimited number of connections and uses the given configurator to configure the connection.
UdpConnectionHandler(NetConnectionConfigurator<UdpConnection> configurator, int maxConnections)
          Creates a new UDP connection handler that uses the given configurator to configure incoming connections and limits the maximum number of active connections to maxConnections.
 
Method Summary
protected  UdpConnection createConnection(UdpServer server, DatagramPacket packet)
          Creates a new connection for an incoming connection request.
 
Methods inherited from class com.kuka.comm.net.NetConnectionHandler
acceptConnection, getConfigurator, getMaxConnections, handleConnection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UdpConnectionHandler

public UdpConnectionHandler(NetConnectionConfigurator<UdpConnection> configurator)
Creates a new UDP connection handler that accepts an unlimited number of connections and uses the given configurator to configure the connection.

Parameters:
configurator - the configurator used to configure incoming connections, must not be null

UdpConnectionHandler

public UdpConnectionHandler(NetConnectionConfigurator<UdpConnection> configurator,
                            int maxConnections)
Creates a new UDP connection handler that uses the given configurator to configure incoming connections and limits the maximum number of active connections to maxConnections.

Parameters:
configurator - the configurator used to configure incoming connections, must not be null
maxConnections - the maximum number of simultaneous connections, must be greater than 0
Method Detail

createConnection

protected final UdpConnection createConnection(UdpServer server,
                                               DatagramPacket packet)
Description copied from class: NetConnectionHandler
Creates a new connection for an incoming connection request.

Specified by:
createConnection in class NetConnectionHandler<UdpServer,UdpConnection,DatagramPacket>
Parameters:
server - the server receiving the incoming connection request
packet - object that can be used to identify the incoming connection request
Returns:
a connection object managing the incoming request


Copyright © 2019. All rights reserved.