Package it.polimi.ingsw.network.client
Class ServerConnector
java.lang.Object
it.polimi.ingsw.network.client.ServerConnector
public class ServerConnector
extends java.lang.Object
Class that manage the connection with the server.
This class receives and send Messages
-
Constructor Summary
Constructors Constructor Description ServerConnector(java.net.Socket server, Client client)Constructor for CliDrawer class -
Method Summary
Modifier and Type Method Description voidhandleServerConnection()Receives messages from server formatted in Json, de-parses them into Message class and sends them to clientvoidsendToServer(Message msg)Sends the message passed as parameter to servervoidstop()sends a quit message to server and closes client socketMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
ServerConnector
Constructor for CliDrawer class- Parameters:
server- , socket that connects this class to serverclient- , client's instance
-
-
Method Details
-
handleServerConnection
public void handleServerConnection()Receives messages from server formatted in Json, de-parses them into Message class and sends them to client -
stop
public void stop()sends a quit message to server and closes client socket -
sendToServer
Sends the message passed as parameter to server- Parameters:
msg- , message to send
-