Class ServerClientHandler

java.lang.Object
it.polimi.ingsw.network.server.ServerClientHandler
All Implemented Interfaces:
java.lang.Runnable

public class ServerClientHandler
extends java.lang.Object
implements java.lang.Runnable
Every instance of this class handles the server side connection of a specific client
  • Method Summary

    Modifier and Type Method Description
    void actionAnswereMessage​(Message answerMessage)
    this method should be called to handle the message returned by the handleAction method in turnManager class
    void closeSocket()
    closes this client's socket
    java.lang.String getUsername()  
    boolean isConnected()  
    boolean isLogged()  
    void run()  
    protected void sendMessage​(Message message)
    Sends the message to the client associated with this ClientHandler trough the socket
    void setConnected​(boolean connected)  
    void setLogged​(boolean logged)  
    void setUsername​(java.lang.String username)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • run

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

      public void actionAnswereMessage​(Message answerMessage)
      this method should be called to handle the message returned by the handleAction method in turnManager class
      Parameters:
      answerMessage - the message returned by the handleAction method in turnManager
    • sendMessage

      protected void sendMessage​(Message message)
      Sends the message to the client associated with this ClientHandler trough the socket
      Parameters:
      message - the message to be sent
    • closeSocket

      public void closeSocket()
      closes this client's socket
    • isConnected

      public boolean isConnected()
    • isLogged

      public boolean isLogged()
    • setLogged

      public void setLogged​(boolean logged)
    • getUsername

      public java.lang.String getUsername()
    • setUsername

      public void setUsername​(java.lang.String username)
    • setConnected

      public void setConnected​(boolean connected)