if (!read_server_command && something_to_send) { send_command read_response } else { # handle server command send_response }