Package it.polimi.ingsw.network.server
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 voidactionAnswereMessage(Message answerMessage)this method should be called to handle the message returned by the handleAction method in turnManager classvoidcloseSocket()closes this client's socketjava.lang.StringgetUsername()booleanisConnected()booleanisLogged()voidrun()protected voidsendMessage(Message message)Sends the message to the client associated with this ClientHandler trough the socketvoidsetConnected(boolean connected)voidsetLogged(boolean logged)voidsetUsername(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:
runin interfacejava.lang.Runnable
-
actionAnswereMessage
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
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)
-