[Live-devel] setupDatagramSocket - SO_REUSEADDR problems

Guido Marelli guido.marelli at intraway.com
Tue Mar 10 21:52:32 PDT 2009


Hi,
I'm agraid I have to desagree with you. 

It seems that the code on MediaSubsession::initiate will cause the effect
I'am reporting when the OS offers the same odd port number for both the
video and the audio stream. 

The method looks like this: 


While (1) {
unsigned short rtpPortNum = fClientPortNum&~1; 

...

fRTPSocket = new Groupsock(env(), tempAddr, rtpPortNum, 255); 

...

fClientPortNum = ntohs(clientPort.num()); 

...

fClientPortNum += 2

}


So you force the OS to give you an explicit port (rtpPortNum), a port that
it will always give you cause you are using SO_REUSEPORT.



Regards,
Guido
 

-----Mensaje original-----
De: live-devel-bounces at ns.live555.com
[mailto:live-devel-bounces at ns.live555.com] En nombre de Ross Finlayson
Enviado el: Martes, 10 de Marzo de 2009 22:56
Para: LIVE555 Streaming Media - development & use
Asunto: Re: [Live-devel] setupDatagramSocket - SO_REUSEADDR problems

>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/
_______________________________________________
live-devel mailing list
live-devel at lists.live555.com
http://lists.live555.com/mailman/listinfo/live-devel

No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.0.237 / Virus Database: 270.11.10/1994 - Release Date: 03/10/09
19:51:00



More information about the live-devel mailing list