I'm trying to write some kind of service browser with Avahi. Discovering and resolving new services works just fine, however I'm facing a problem when I try to resolve service that was lost in ItemRemoved handler. "org.freedesktop.Avahi.TimeoutError: Timeout reached" error occures. I suppose I'm doing it wrong way, thus my question is:
How can i resolve IP address of lost service in ItemRemoved handler?
If a service is removed, you won't be able to resolve it since the service no longer exists. It's records are no longer valid.
What you need to do is use the DNS-SD service name (e.g. My Print Service._http._tcp) as the key that you store and remove things from in your internal cache.
Ideally you would only resolve the service when you actually need to connect to it, this helps both in reducing network traffic and also ensuring the IP address up to date/valid when you go to use it. Once resolved if you store the IP along with the service name, then you have what you need it would seem.