Package it.polimi.ingsw.client
Class HeartbeatClient
java.lang.Object
java.util.TimerTask
it.polimi.ingsw.client.HeartbeatClient
- All Implemented Interfaces:
java.lang.Runnable
public class HeartbeatClient
extends java.util.TimerTask
implements java.lang.Runnable
Allows the client to send a ping message to the server, to let him know that the client is still alive.
The Ping message is sent at fixed rate.
-
Constructor Summary
Constructors Constructor Description HeartbeatClient(NetworkHandler clientNetworkHandler) -
Method Summary
-
Constructor Details
-
Method Details
-
run
public void run()Until the connection is alive, sends the ping message to the server at fixed rate. Otherwise stops when connection is shut down.- Specified by:
runin interfacejava.lang.Runnable- Specified by:
runin classjava.util.TimerTask
-
sendPing
public void sendPing()Sends to the server teh ping message.
-