log when we disconnect. Wrap sending in a try/except and reconnect if sending data fails.