[Live-devel] Problem with ourSourceAddressForMulticast()

Ross Finlayson finlayson at live555.com
Thu Feb 1 13:09:44 PST 2007


>  > If that happens, then you have a more serious problem: you've stopped
>>  multicast from working!  For multicast to work, your
>>  "ReceivingInterfaceAddr" - if not INADDR_ANY - must be set to the
>>  interface on which you have a route for 224.*.
>I'm not doing multicast at all, only unicast. But, each time a 
>Groupsock is created a call of ourSourceAddressForMulticast is 
>performed and thus some multicast sending/receiving also.

Once (the admittedly badly named) "ourSourceAddressForMulticast()" 
function succeeds in getting a proper IP address, it will just return 
that same address from then on (with no more multicast).


>  And I really guess that 99% of computers of our beautiful planet 
>will fail to read the multicast packet sent to guess our source 
>address IF you set ReceivingInterfaceAddr and SendingInterfaceAddr 
>to your ethernet IP address (example : 192.168.0.1).

Well, "99% of computers of our beautiful planet" will have no need to 
set these addresses at all, because they have only one network 
interface.

The real question here (which I don't know the answer to) is: If you 
set these addresses to a (valid) local IP address, then why does 
multicast loopback fail, and can this be fixed?


>  > > - 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().
>>
>>  That's not supposed to happen.  The code is supposed to check through
>>  *all* of the addresses returned by "gethostbyname()", and use the
>>  first address that is not bad (and 127.0.0.1 is considered 'bad').
>The code is correct. The problem is that a Linux machine seems to 
>answer with only the FIRST address it finds for the hostname, most 
>of the time 127.0.0.1. I observed this on my Linux RedHat Enterprise 
>4 server, and crosscheked on some forums on internet.

Do you know of any way to work around this, or else know of some 
alternative way to look up a valid IP address (rather than by 
explicitly parsing the /etc/hosts file, which would be gross) that 
will work on Linux systems (and not break on other systems)?  If so, 
I could add it - as a third mechanism to try - to the 
"ourSourceAddressForMulticast()" code.

I want to come up with code that works.  Just throwing up my hands 
and saying "if this code doesn't work, here's how to hard-wire the 
address yourself" is not an acceptable solution (it's the ultimate in 
non-portable code :-).  Of course, this is source code, so if people 
really want to do this, they can.  I just don't want to encourage it.
-- 

Ross Finlayson
Live Networks, Inc.
http://www.live555.com/


More information about the live-devel mailing list