com.kuka.roboticsAPI.controllerModel.sunrise.connectionLib
Class TcpChannel

java.lang.Object
  extended by com.kuka.roboticsAPI.controllerModel.sunrise.connectionLib.TcpChannel

public class TcpChannel
extends Object

A TcpChannel is a channel implementation using the TCP protocol.

This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

Constructor Summary
TcpChannel()
          Creates a new TcpChannel instance.
 
Method Summary
protected  void acceptClient()
          Tells the channel to accept a client.
protected  Socket acceptClientSocket()
          Called when a client socket should be accepted.
protected  void closeServerSocket()
          Called when a client was accepted and the server socket should be closed.
protected static void closeSharedServerSocket()
          Closes the shared listener socket.
protected  ServerSocket createServerSocket()
          Creates the server socket for this channel and returns it.
protected  void dispose()
          Disposes the channel.
protected  String getAddress()
          Gets the address of the channel.
protected  CommunicationMedium getMedium()
          Gets the medium over which the channel transports it's data.
protected  NameserverProxy getNameserverProxy()
          Gets the nameserver proxy with which the channel was created.
protected  void initialize()
          Initializes the channel.
protected  boolean isInitialized()
          Returns true if this channel is initialized.
protected  void openClientPort()
          Tells the channel to open a port for a client.
protected  void send(Message message)
          Sends the given message over the channel.
protected  void setNameserverProxy(NameserverProxy proxy)
          Sets the nameserver proxy with which the channel was created.
protected  void setServerAddress(String address)
          Sets the server address for this channel.
protected  Message tryReceive(int timeout, TimeUnit timeUnit)
          Tries to receive a message from the channel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TcpChannel

public TcpChannel()
Creates a new TcpChannel instance.

This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.
Method Detail

send

protected void send(Message message)
Sends the given message over the channel.

Parameters:
message - The message to send.

tryReceive

protected Message tryReceive(int timeout,
                             TimeUnit timeUnit)
Tries to receive a message from the channel.

Parameters:
timeout - The timeout value.
timeUnit - The timeout until
Returns:
The received message or null if no message was received in the given timeout.

dispose

protected void dispose()
Disposes the channel. Closes all communication resources.


initialize

protected void initialize()
Initializes the channel.


isInitialized

protected boolean isInitialized()
Returns true if this channel is initialized.

Returns:
True if this channel is initialized.

setServerAddress

protected void setServerAddress(String address)
Sets the server address for this channel. This method must be called before the channel can be initialized in client mode.

Parameters:
address - The address string received from the nameserver.

openClientPort

protected void openClientPort()
Tells the channel to open a port for a client. After this method was called, the getAddress method should return the address for the client (setServerAddress method).


createServerSocket

protected ServerSocket createServerSocket()
Creates the server socket for this channel and returns it. The socket must be open and bound.

Returns:
The server socket for this channel.

getAddress

protected String getAddress()
Gets the address of the channel.

Returns:
The address of the channel.

acceptClient

protected void acceptClient()
Tells the channel to accept a client. The method openClientPort must be called before. After a client was accepted, the client port can be closed.


closeSharedServerSocket

protected static void closeSharedServerSocket()
Closes the shared listener socket. Should be called on VM dispose.


closeServerSocket

protected void closeServerSocket()
Called when a client was accepted and the server socket should be closed. Can be overridden by subclasses if the server socket should not be closed.


acceptClientSocket

protected Socket acceptClientSocket()
Called when a client socket should be accepted.

Returns:
The accepted client socket.

getMedium

protected CommunicationMedium getMedium()
Gets the medium over which the channel transports it's data.

Returns:
The medium over which the channel transports it's data.

setNameserverProxy

protected final void setNameserverProxy(NameserverProxy proxy)
Sets the nameserver proxy with which the channel was created.

Parameters:
proxy - The proxy.

getNameserverProxy

protected final NameserverProxy getNameserverProxy()
Gets the nameserver proxy with which the channel was created.

Returns:
The nameserver proxy with which the channel was created.


Copyright © 2019. All rights reserved.