[avahi] How to resolve only ipv4 addresses?

José Félix Ontañón felixonta at gmail.com
Thu Feb 25 15:26:44 PST 2010


2010/2/21  <felixonta at gmail.com>:
> 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

Sorry but i'm on avahi 0.6.25 (ubuntu karmic's default) and
avahi.PROTO_IPV4 doesn't exists. Need i a higher
version of avahi? Would avahi.PROTO_INET make the same effect? Is
there any good doc to learn about
the use and meaning of this constants?

Thanks.

> --
> 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



-- 
http://fontanon.org


More information about the avahi mailing list