fixes #29 - checking if socket is connected