check if socket is opened before attempting to send anything