Added ability to check whether client is connected or not