synergynetframework.appsystem.services.net.objectmessaging.connections
Class ConnectionHandler

java.lang.Object
  extended by synergynetframework.appsystem.services.net.objectmessaging.connections.ConnectionHandler
Direct Known Subclasses:
Client

public class ConnectionHandler
extends java.lang.Object

The Class ConnectionHandler.


Field Summary
 java.net.InetSocketAddress udpRemoteAddress
          The udp remote address.
 
Constructor Summary
ConnectionHandler(int bufferSize)
          Instantiates a new connection handler.
 
Method Summary
 void addMessageHandler(MessageHandler handler)
          Adds the message handler.
 void close()
          Close.
 EndPoint getEndPoint()
          Gets the end point.
 short getID()
          Gets the id.
 java.net.InetSocketAddress getRemoteAddressTCP()
          Gets the remote address tcp.
 java.net.InetSocketAddress getRemoteAddressUDP()
          Gets the remote address udp.
 TCPConnectionHandler getTCPConnection()
          Gets the TCP connection.
 UDPConnectionHandler getUDPConnection()
          Gets the UDP connection.
 void notifyConnected()
          Notify connected.
 void notifyReceived(java.lang.Object object)
          Notify received.
 void removeMessageHandler(MessageHandler handler)
          Removes the message handler.
 void sendMessage(Message message)
          Send message.
 void sendTCP(java.lang.Object object)
          Send tcp.
 void sendUDP(java.lang.Object object)
          Send udp.
 void setEndPoint(EndPoint endPoint)
          Sets the end point.
 void setID(short id)
          Sets the id.
 void setName(java.lang.String name)
          Sets the name.
 void setTCPAliveTime(int keepAliveMillis)
          Sets the TCP alive time.
 void setTCPConnection(TCPConnectionHandler tcp)
          Sets the TCP connection.
 void setUDPConnection(UDPConnectionHandler udp)
          Sets the UDP connection.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

udpRemoteAddress

public java.net.InetSocketAddress udpRemoteAddress
The udp remote address.

Constructor Detail

ConnectionHandler

public ConnectionHandler(int bufferSize)
Instantiates a new connection handler.

Parameters:
bufferSize - the buffer size
Method Detail

addMessageHandler

public void addMessageHandler(MessageHandler handler)
Adds the message handler.

Parameters:
handler - the handler

close

public void close()
Close.


getEndPoint

public EndPoint getEndPoint()
Gets the end point.

Returns:
the end point

getID

public short getID()
Gets the id.

Returns:
the id

getRemoteAddressTCP

public java.net.InetSocketAddress getRemoteAddressTCP()
Gets the remote address tcp.

Returns:
the remote address tcp

getRemoteAddressUDP

public java.net.InetSocketAddress getRemoteAddressUDP()
Gets the remote address udp.

Returns:
the remote address udp

getTCPConnection

public TCPConnectionHandler getTCPConnection()
Gets the TCP connection.

Returns:
the TCP connection

getUDPConnection

public UDPConnectionHandler getUDPConnection()
Gets the UDP connection.

Returns:
the UDP connection

notifyConnected

public void notifyConnected()
Notify connected.


notifyReceived

public void notifyReceived(java.lang.Object object)
Notify received.

Parameters:
object - the object

removeMessageHandler

public void removeMessageHandler(MessageHandler handler)
Removes the message handler.

Parameters:
handler - the handler

sendMessage

public void sendMessage(Message message)
                 throws java.io.IOException
Send message.

Parameters:
message - the message
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

sendTCP

public void sendTCP(java.lang.Object object)
             throws java.io.IOException
Send tcp.

Parameters:
object - the object
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

sendUDP

public void sendUDP(java.lang.Object object)
             throws java.io.IOException
Send udp.

Parameters:
object - the object
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

setEndPoint

public void setEndPoint(EndPoint endPoint)
Sets the end point.

Parameters:
endPoint - the new end point

setID

public void setID(short id)
Sets the id.

Parameters:
id - the new id

setName

public void setName(java.lang.String name)
Sets the name.

Parameters:
name - the new name

setTCPAliveTime

public void setTCPAliveTime(int keepAliveMillis)
Sets the TCP alive time.

Parameters:
keepAliveMillis - the new TCP alive time

setTCPConnection

public void setTCPConnection(TCPConnectionHandler tcp)
Sets the TCP connection.

Parameters:
tcp - the new TCP connection

setUDPConnection

public void setUDPConnection(UDPConnectionHandler udp)
Sets the UDP connection.

Parameters:
udp - the new UDP connection

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object