[avahi] How to resolve only ipv4 addresses?

felixonta at gmail.com felixonta at gmail.com
Sun Feb 21 12:05:07 PST 2010


Hi Lennart, i really appreciate your help. 
You are right, it seems to be so simple solution that i must found it on the documentation. I suppose i missed on first read.

Cheers!
------Mensaje original------
De: Lennart Poettering
Remitente:avahi-bounces at lists.freedesktop.org
Para:avahi at lists.freedesktop.org
Responder a:Avahi ML
Asunto: Re: [avahi] How to resolve only ipv4 addresses?
Enviado: 21 Feb, 2010 20:41

On Sun, 21.02.10 13:18, José Félix Ontañón (felixonta at gmail.com) wrote:

> Hi everyone!
> 
> I'm programming a python app that uses service discovering in what i think,
> it's a very basic way:
> 
> http://www.pastebin.com/f17ab27c1
> 
> The fact it's that when i call resolve() sometimes an ipv6 address it's
> returned. How can i force to only resolve ipv4 address?

It sometimes helps reading the documentation:

Replace this:

    def resolve(self, interface, protocol, name, stype, domain, flags=None):
        interface, protocol, name, stype, domain, host, aprotocol, address, \
            port, txt, flags = self.server.ResolveService(interface, protocol,
                        name, stype, domain, avahi.PROTO_UNSPEC,
                        dbus.UInt32(0))

by this:


    def resolve(self, interface, protocol, name, stype, domain, flags=None):
        interface, protocol, name, stype, domain, host, aprotocol, address, \
            port, txt, flags = self.server.ResolveService(interface, protocol,
                        name, stype, domain, avahi.PROTO_IPV4, dbus.UInt32(0))

Have fun,

Lennart

-- 
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/           GnuPG 0x1A015CC4
_______________________________________________
avahi mailing list
avahi at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/avahi


http://fontanon.org


More information about the avahi mailing list