[Live-devel] Problem with ourSourceAddressForMulticast()

David Betrand bidibulle at operamail.com
Thu Feb 1 07:54:23 PST 2007


Hello Ross,
I recently investigated some strange problems to get a valid source IP address with some recent version of the library, which I didn't have with older versions. As you know ths is done using ourSourceAddressForMulticast() in GroupsockHelper


Actually, ourSourceAddressForMulticast() tells me "This computer has an invalid IP address : 0x0". The full explanation of the failing is quite complex to explain so I prefer to summarize the important results :

- Setting ReceivingInterfaceAddr and SendingInterfaceAddr to a value different from INADDR_ANY makes the multicast loopback trick fail. I guess this is normal on a regular Linux configuration, without multicast environment. Do you agree ? This means that (after a 5 second timeout) the secondary approach to get its source IP will be used : using getting first valid IP address from gethostname() followed by gethostbyname()

- Getting a valid IP address from gethostname() followed by gethostbyname() doesn't work on most unix and linux systems as it only returns the first entry in /etc/hosts file : 127.0.0.1. And this IP address is rejected by badAddress(). So this means that the secondary  plan also fails in my case ! -> I get the message "This computer has an invalid IP address : 0x0"

So, is it reasonnable to set a global static variable for the source address. Something like ourAddress variable in ourSourceAddressForMulticast():
static netAddressBits ourAddress = 0;

By default, It would be initialized with zero but would allow to be set to another value (for example ReceivingInterfaceAddr or SendingInterfaceAddr)

Thanks in dvance.
David


-- 
_______________________________________________
Search for products and services at: 
http://search.mail.com

Powered by Outblaze



More information about the live-devel mailing list