[Live-devel] setupDatagramSocket - SO_REUSEADDR problems

Ross Finlayson finlayson at live555.com
Tue Mar 10 18:56:29 PDT 2009


>Hi,
>I've found that in some cases (it seems to be random) the method 
>mediaSubsession::initiate will use the same UDP ports for both a 
>video stream and an audio stream. A sample output for the openRTSP 
>program is the following:
>
>
>Created receiver for "video/MP4V-ES" subsession (client ports 34394-34395)
>Created receiver for "audio/PCMU" subsession (client ports 34394-34395)
>Setup "video/MP4V-ES" subsession (client ports 34394-34395)
>Setup "audio/PCMU" subsession (client ports 34394-34395)
>
>
>The problem seems to be the SO_REUSEPORT socket option on the 
>setupDatagramSocket function.
>So, my question is: Is it safe to disable that option?

The SO_REUSEPORT option is intended to allow more than one process - 
on the same host - to use the same (explicit) socket number.  For 
example, it allows more than one application to receive the same 
multicast stream, or, in the case of a unicast stream, it allows a 
different process to receive it than the actual RTSP client (e.g., 
the "-r" option to "openRTSP").  It should not be allowing the OS to 
hand out the same ephemeral port number more than once.  If your OS 
is doing this, then it may be buggy.

If you're not anticpating any other process on the client host from 
receiving the stream, then you could probably get away with not 
setting SO_REUSEPORT.  However, fixing your buggy OS is probably the 
better option :-)

-- 

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


More information about the live-devel mailing list