|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.kuka.comm.AbstractServer
com.kuka.comm.AbstractThreadedServer
com.kuka.comm.net.UdpServer
public final class UdpServer
The UdpServer class creates a new UDP server for use with the KUKA Navigation Communication
Framework.
After instantiation of this class, it will listening to a specified port for new incoming UdpConnection
requests until its stop() method will be called. This listening is a blocking operation. Therefore
this UdpServer will be started as an own thread by calling its start() method. The incoming
datagram packets are forwarded to the corresponding connection based on the sender of the packet. If no connection
accepts this sender, a new connection will be created and passed to the connection handler, and, if accepted, will
receive the packet.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.kuka.comm.AbstractServer |
|---|
AbstractServer.ConnectionConsumer |
| Constructor Summary | |
|---|---|
UdpServer(InetSocketAddress serverAddress,
Encoder<Object,ByteBuffer> enc,
Decoder<ByteBuffer,Object> dec)
Constructor for UdpServer with defined port and IPAddress. |
|
UdpServer(InetSocketAddress serverAddress,
UdpConnectionHandler handler)
Constructor for UdpServer with defined port and IPAddress. |
|
UdpServer(int port,
Encoder<Object,ByteBuffer> enc,
Decoder<ByteBuffer,Object> dec)
Constructor for UdpServer with defined port. |
|
UdpServer(int port,
UdpConnectionHandler handler)
Constructor for UdpServer with defined port. |
|
| Method Summary | |
|---|---|
InetAddress |
getAddress()
Returns the server address. |
int |
getPort()
Returns the server port. |
int |
getReceiveBufferSize()
Returns the receiving buffer size. |
UdpConnectionHandler |
getUdpConnHandler()
Returns the UDP connection factory. |
protected void |
serverThread()
Implement the server thread! |
void |
setReceiveBufferSize(int bufferSize)
Sets the receiving buffer size to the given value. |
void |
start()
Starts the server as a separate thread. |
void |
stop()
Stops the server closes all created connections listed in its internal list of connections. |
| Methods inherited from class com.kuka.comm.AbstractThreadedServer |
|---|
isRunning, isStopRequested, isThreadAlive, setStopRequested |
| Methods inherited from class com.kuka.comm.AbstractServer |
|---|
addConnection, addServerListener, closeAllConnections, countConnections, fireAcceptedConnection, fireIncomingConnection, fireRejectedConnection, forEachConnection, getConnections, hasConnections, removeConnection, removeServerListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public UdpServer(int port,
Encoder<Object,ByteBuffer> enc,
Decoder<ByteBuffer,Object> dec)
IPAddress is undefined and will be selected by kernel.
port - The listening port for UDPServer.enc - The encoder.dec - The decoder.
public UdpServer(InetSocketAddress serverAddress,
Encoder<Object,ByteBuffer> enc,
Decoder<ByteBuffer,Object> dec)
serverAddress - The IPAddress for UDPServer. Only packets with this IP will be accepted.enc - The encoder.dec - The decoder.
public UdpServer(int port,
UdpConnectionHandler handler)
IPAddress is undefined and will be selected by kernel.
port - The listening port for UDPServer.handler - the connection handler
public UdpServer(InetSocketAddress serverAddress,
UdpConnectionHandler handler)
serverAddress - The IPAddress for UDPServer. Only packets with this IP will be accepted.handler - the connection handler| Method Detail |
|---|
public void setReceiveBufferSize(int bufferSize)
bufferSize - the receiving buffer sizepublic int getReceiveBufferSize()
public UdpConnectionHandler getUdpConnHandler()
public void start()
Server
start in interface Serverstart in class AbstractThreadedServerprotected void serverThread()
AbstractThreadedServer
serverThread in class AbstractThreadedServerpublic InetAddress getAddress()
public int getPort()
public void stop()
Server
stop in interface Serverstop in class AbstractThreadedServer
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||