synergynetframework.appsystem.services.net.objectmessaging
Class Server

java.lang.Object
  extended by synergynetframework.appsystem.services.net.objectmessaging.Server
All Implemented Interfaces:
java.lang.Runnable, EndPoint

public class Server
extends java.lang.Object
implements EndPoint

The Class Server.


Constructor Summary
Server()
          Instantiates a new server.
Server(int bufferSize)
          Instantiates a new server.
 
Method Summary
 void addMessageHandler(MessageHandler handler)
          Adds the message handler.
 void bind(int tcpPort)
          Bind.
 void bind(int tcpPort, int udpPort)
          Bind.
 void close()
          Close.
 java.util.Queue<ConnectionHandler> getHandlers()
          Gets the handlers.
 java.lang.Thread getUpdateThread()
          Gets the update thread.
 boolean isRunning()
          Checks if is running.
 void removeMessageHandler(MessageHandler handler)
          Removes the message handler.
 void run()
           
 void sendMessage(short connectionID, Message message)
          Send message.
 void sendMessageToAll(Message message)
          Send message to all.
 void sendMessageToAllExcept(short connectionID, Message message)
          Send message to all except.
 void sendToAllExceptTCP(short connectionID, java.lang.Object object)
          Send to all except tcp.
 void sendToAllExceptUDP(short connectionID, java.lang.Object object)
          Send to all except udp.
 void sendToAllTCP(java.lang.Object object)
          Send to all tcp.
 void sendToAllUDP(java.lang.Object object)
          Send to all udp.
 void sendToTCP(short connectionID, java.lang.Object object)
          Send to tcp.
 void sendToUDP(short connectionID, java.lang.Object object)
          Send to udp.
 void stop()
          Stop.
 void update(int timeout)
          Update.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Server

public Server()
Instantiates a new server.


Server

public Server(int bufferSize)
Instantiates a new server.

Parameters:
bufferSize - the buffer size
Method Detail

addMessageHandler

public void addMessageHandler(MessageHandler handler)
Description copied from interface: EndPoint
Adds the message handler.

Specified by:
addMessageHandler in interface EndPoint
Parameters:
handler - the handler

bind

public void bind(int tcpPort)
          throws java.io.IOException
Bind.

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

bind

public void bind(int tcpPort,
                 int udpPort)
          throws java.io.IOException
Bind.

Parameters:
tcpPort - the tcp port
udpPort - the udp port
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

close

public void close()
Description copied from interface: EndPoint
Close.

Specified by:
close in interface EndPoint

getHandlers

public java.util.Queue<ConnectionHandler> getHandlers()
Gets the handlers.

Returns:
the handlers

getUpdateThread

public java.lang.Thread getUpdateThread()
Description copied from interface: EndPoint
Gets the update thread.

Specified by:
getUpdateThread in interface EndPoint
Returns:
the update thread

isRunning

public boolean isRunning()
Checks if is running.

Returns:
true, if is running

removeMessageHandler

public void removeMessageHandler(MessageHandler handler)
Description copied from interface: EndPoint
Removes the message handler.

Specified by:
removeMessageHandler in interface EndPoint
Parameters:
handler - the handler

run

public void run()
Specified by:
run in interface java.lang.Runnable
Specified by:
run in interface EndPoint

sendMessage

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

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

sendMessageToAll

public void sendMessageToAll(Message message)
                      throws java.io.IOException
Send message to all.

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

sendMessageToAllExcept

public void sendMessageToAllExcept(short connectionID,
                                   Message message)
                            throws java.io.IOException
Send message to all except.

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

sendToAllExceptTCP

public void sendToAllExceptTCP(short connectionID,
                               java.lang.Object object)
                        throws java.io.IOException
Send to all except tcp.

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

sendToAllExceptUDP

public void sendToAllExceptUDP(short connectionID,
                               java.lang.Object object)
                        throws java.io.IOException
Send to all except udp.

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

sendToAllTCP

public void sendToAllTCP(java.lang.Object object)
                  throws java.io.IOException
Send to all tcp.

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

sendToAllUDP

public void sendToAllUDP(java.lang.Object object)
                  throws java.io.IOException
Send to all udp.

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

sendToTCP

public void sendToTCP(short connectionID,
                      java.lang.Object object)
               throws java.io.IOException
Send to tcp.

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

sendToUDP

public void sendToUDP(short connectionID,
                      java.lang.Object object)
               throws java.io.IOException
Send to udp.

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

stop

public void stop()
Description copied from interface: EndPoint
Stop.

Specified by:
stop in interface EndPoint

update

public void update(int timeout)
            throws java.io.IOException
Description copied from interface: EndPoint
Update.

Specified by:
update in interface EndPoint
Parameters:
timeout - the timeout
Throws:
java.io.IOException - Signals that an I/O exception has occurred.