Crash Screen

I have been wanting to make my own version of one of these and im not sure who to check is the server is crashing or the player is losing connection to the server. any and all help will be appreciated.

Sends messages to server, if server doesn’t send a message back, then server crashed