Class GuestHandler

java.lang.Object
model.logic.host.GuestHandler
All Implemented Interfaces:
Serializable, ClientHandler

public class GuestHandler extends Object implements ClientHandler, Serializable
See Also:
  • Constructor Details

    • GuestHandler

      public GuestHandler()
  • Method Details

    • handleClient

      public void handleClient(InputStream in, OutputStream out)
      The handleClient function is responsible for handling the client's requests. It receives a request from the client, and then it sends back an appropriate response to the client. The function also handles all the game logic that occurs during a player's turn, such as checking if their move is legal or not.
      Specified by:
      handleClient in interface ClientHandler
      Parameters:
      in - in Read the client's request
      out - out Send messages to the client
    • close

      public void close()
      The close function is used to stop the thread from running. It sets stillPlaying to false, which causes the while loop in run() to terminate. This allows for a clean exit of the program without any errors or exceptions being thrown.
      Specified by:
      close in interface ClientHandler