How about... - Look up all the addresses in the URL - resolve to IPv4/6 addresses - Compare each one to the IPv4/6 addresses on each network interface on the system
-Steve > -----Original Message----- > From: Alan Conway [mailto:[email protected]] > Sent: Monday, January 30, 2012 10:23 AM > To: Qpid Dev > Subject: [c++ broker] Anyone have a good algorithm for determining if 2 > addresses (protocol:host:port) are for the same broker? > > Puzzle for you: > > I want a broker to be able to eliminate its own addresss from a multi-address > URL so that it doesn't end up connecting to itself. Anyone got a technique for > that? It has to work with IPv4, IPv6, DNS names, /etc/host names and any > other way a user is allowed to express a broker address. It has to work for all > the protocols the broker supports and it has to work on hosts with multiple > NICs. > > Best I can come up with so far is for the broker to connect to all the > addresses and send a UUID or some such token, then see if it gets a > connection back to itself - if so eliminate the address. Anyone got a simpler > solution? > > Cheers, > Alan. > > > --------------------------------------------------------------------- > Apache Qpid - AMQP Messaging Implementation > Project: http://qpid.apache.org > Use/Interact: mailto:[email protected] --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:[email protected]
