|
||||||||||
| 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.TcpServer
public final class TcpServer
The TcpServer class creates a new TCP server for use with the KUKA Navigation Communication Framework.
After instantiation of this class, it will listening to a specified port for new incoming TcpConnection
requests until its stop() method will be called. This listening is a blocking operation. Therefore
this TcpServer will be started as an own thread by calling its start() method.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.kuka.comm.AbstractServer |
|---|
AbstractServer.ConnectionConsumer |
| Constructor Summary | |
|---|---|
TcpServer(InetSocketAddress serverAddress,
Encoder<Object,ByteBuffer> enc,
Decoder<ByteBuffer,Object> dec)
Constructor to setup an new TCP server with a given InetSocketAddress to listen on. |
|
TcpServer(InetSocketAddress serverAddress,
TcpConnectionHandler handler)
Constructor to setup an new TCP server with a given InetSocketAddress to listen on. |
|
TcpServer(int port,
Encoder<Object,ByteBuffer> enc,
Decoder<ByteBuffer,Object> dec)
Constructor to setup an new TCP server with a given port to listen on. |
|
TcpServer(int port,
TcpConnectionHandler handler)
Constructor to setup an new TCP server with a given port to listen on. |
|
| Method Summary | |
|---|---|
InetAddress |
getAddress()
Returns the server address. |
int |
getPort()
Returns the server port. |
TcpConnectionHandler |
getTcpConnHandler()
Get method for the factory method, which creates new TcpConnections upon incoming connections. |
protected void |
serverThread()
Implement the server thread! |
void |
start()
Starts the server as a separate thread. |
void |
stop()
Method to stop the TcpServer by closing the ServerSocket. |
| 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 TcpServer(int port,
Encoder<Object,ByteBuffer> enc,
Decoder<ByteBuffer,Object> dec)
port - The port as Integer to listen for new connections.enc - The encoder to encode messages.dec - the decoder to decoder messages.
public TcpServer(InetSocketAddress serverAddress,
Encoder<Object,ByteBuffer> enc,
Decoder<ByteBuffer,Object> dec)
InetSocketAddress to listen on.
serverAddress - The InetSocketAddress which specifies the host address and port.enc - The encoder to encode messages.dec - the decoder to decoder messages.
public TcpServer(int port,
TcpConnectionHandler handler)
port - The port as Integer to listen for new connections.handler - A handler creating and configuring incoming connections.
public TcpServer(InetSocketAddress serverAddress,
TcpConnectionHandler handler)
InetSocketAddress to listen on.
serverAddress - The InetSocketAddress which specifies the host address and port.handler - A handler creating and configuring incoming connections.| Method Detail |
|---|
public TcpConnectionHandler getTcpConnHandler()
TcpConnections upon incoming connections.
TcpConnectionConfigurator which creates new TcpConnections.public void start()
Server
start in interface Serverstart in class AbstractThreadedServerprotected void serverThread()
AbstractThreadedServer
serverThread in class AbstractThreadedServerpublic void stop()
TcpServer by closing the ServerSocket. Its reference will be deleted upon next
garbage collection.
stop in interface Serverstop in class AbstractThreadedServerpublic InetAddress getAddress()
public int getPort()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||