Periodically call maybe_flush_socket().