[Live-devel] UDP sockets don't use ReceivingInterfaceAddr?

Ross Finlayson finlayson at live555.com
Mon Feb 23 22:31:11 PST 2009


>I'm trying to use ReceivingInterfaceAddr & SendingInterfaceAddr to control
>which interface RTSP/RTP traffic is going in and out on.
>
>In setupDatagramSocket(), there is the line:
>
>     if (port.num() == 0) addr = ReceivingInterfaceAddr;
>
>This line is just prior to the bind() call.  So.. UDP ports are only bound to
>a particular interface if portnum is also 0.  Because of this, all the UDP
>sockets used for RTP traffic are bound to IP_ADDRANY.
>
>Is there a particular reason for this?  Is it a multicast thing or something?

Yes, I think so.  I think the intention was that you would want to 
create a datagram socket with an initial non-zero port number only 
for multicast streams, in which case you probably wouldn't want to 
bind() to something other than INADDR_ANY.  But I'm not sure.

But anyway, if you're really doing this for unicast RTSP/RTP, then 
you shouldn't run into this issue, because - in this case - the port 
number should be 0 when the socket is created, I think.


>Can I change it to make it always set addr from ReceivingInterfaceAddr?

This is Open Source; you can change it to whatever you want :-)  I 
can't guarantee that it will work, though.
-- 

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


More information about the live-devel mailing list