Check if you are connected before each attempt to transmit.
By The Way, switching Screens breaks your connection.