java.lang.Object
model.logic.host.GuestHandler
- All Implemented Interfaces:
Serializable,ClientHandler
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()The close function is used to stop the thread from running.voidhandleClient(InputStream in, OutputStream out) The handleClient function is responsible for handling the client's requests.
-
Constructor Details
-
GuestHandler
public GuestHandler()
-
-
Method Details
-
handleClient
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:
handleClientin interfaceClientHandler- Parameters:
in- in Read the client's requestout- 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:
closein interfaceClientHandler
-