Class ServerThread

java.lang.Object
java.lang.Thread
org.medcare.igtl.network.ServerThread
All Implemented Interfaces:
Runnable

public class ServerThread extends Thread
OpenIGTServer create one ServerThread for each client making a connection. ServerThread will add messages received from client to the messageQueue to be treated then MessageQueueManager will use its ServerThread to send answer to messages.
  • Field Details

  • Constructor Details

  • Method Details

    • run

      public void run()
      Reader thread. Reads messages from the socket and add them to the MessageQueueManager
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread
    • sendMessage

      public void sendMessage(OpenIGTMessage message) throws Exception
      Throws:
      Exception
    • sendMessage

      public void sendMessage(Header header, byte[] body) throws Exception
      Throws:
      Exception
    • sendBytes

      public final void sendBytes(byte[] bytes) throws IOException
      Sends bytes

      Parameters:
      bytes - - byte[] array.
      Throws:
      IOException - - Exception in I/O.

    • interrupt

      public void interrupt()
      Interrupt this thread
      Overrides:
      interrupt in class Thread
    • setStatus

      public void setStatus(OpenIGTServer.ServerStatus status)
      ** To set server status
      Parameters:
      status - **
    • getStatus

      public OpenIGTServer.ServerStatus getStatus()
      ** To set server status **
      Returns:
      the status status
    • getAlive

      public boolean getAlive()
    • setAlive

      public void setAlive(boolean alive)