Soham | Added separate method to check socket connection availability.