Maybe that will be a strange way - you can check the process of the local server - if it is still alive on not. Another way is to send a message to the local server. I'd say that the standard method. You send a message and receive a response - so you know that everything's OK. If you wrote the local server - the task become easier.
Who knows another method?