Module it.polimi.ingsw.am13
Class ServerResponseHandler
java.lang.Object
java.lang.Thread
it.polimi.ingsw.am13.client.network.socket.ServerResponseHandler
- All Implemented Interfaces:
Runnable
This class keeps waiting for responses coming from the server.
Depending on the received message, it calls the corresponding GameStateHandler and View methods.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Chat
Chat storing all the messages involving this playerprivate GameStateHandler
Handler of the representation of the game stateprivate final NetworkHandlerSocket
The socket network handler that sends the messages from the client to the serverprivate final Socket
The socket which is used to communicate with the serverprivate final View
The user interfaceFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
ConstructorsConstructorDescriptionServerResponseHandler
(Socket socket, NetworkHandlerSocket networkHandlerSocket, View view) Constructor of this class, that sets the socket, network handler and view -
Method Summary
Modifier and TypeMethodDescriptionvoid
run()
Thread run method that waits for messages coming from the server, and updates the view and the game state according to the received messageMethods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, toString, yield
-
Field Details
-
socket
The socket which is used to communicate with the server -
gameStateHandler
Handler of the representation of the game state -
networkHandlerSocket
The socket network handler that sends the messages from the client to the server -
view
The user interface -
chat
Chat storing all the messages involving this player
-
-
Constructor Details
-
ServerResponseHandler
Constructor of this class, that sets the socket, network handler and view- Parameters:
socket
- to communicate with the servernetworkHandlerSocket
- that sends the messages from the client to the serverview
- of this client, where the updates received from the server are shown
-
-
Method Details