What benefits will you need to check? Even if you ping this, it does not mean that in the next moment the connection will remain alive when you make your remote call.
Just try / catch the remote calls and find out.
This type of check does not make sense (network connection, file locking, etc.). Since the state of the thing you are checking can change immediately after checking. You just tray, and clean / redo if it doesn't work.
source share