[avahi] How to resolve only ipv4 addresses?
Lennart Poettering
lennart at poettering.net
Sun Feb 21 11:41:17 PST 2010
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
More information about the avahi
mailing list