[Live-devel] RTSPServer port reuse

Ross Finlayson finlayson at live555.com
Fri Oct 28 14:15:10 PDT 2011


> I am using Live555 to run an RTSP server on an embedded system, and I would like to restart the server programmatically.  However, the current RTSPServer implementation does not allow the same port to be re-used if the socket is in a TIME_WAIT state.
>  
> I had a look around and saw a previous thread regarding this issue (http://lists.live555.com/pipermail/live-devel/2011-July/013664.html).

Actually, this thread starts at
	http://lists.live555.com/pipermail/live-devel/2011-July/013648.html
I suggest reading this entire thread to better understand the issues involved.


>   For debugging it is not too difficult to reboot my system or wait for the TIME_WAIT state to end, but for restarting programmatically it would be nice if there were an option to tell the RTSPServer class that I want it to reuse the same port even if there is a socket on that port in the TIME_WAIT state.
>  
> I can obviously change the code, and have done so, but thought I would throw my vote in for allowing this behavior by design.  If you would like a patch for the changes I made (basically adding a default parameter ‘Boolean allowPortReuse = false’ to the relevant RTSPServer functions), I would be happy to send one.

I don't want to add a runtime parameter for this - in part because there are already three default parameters to "RTSPClient::createNew()", and I'd rather not add another one.  (Also, I don't want to make it too easy for people to disable the 'port reuse' check unless (like you) they know what they doing - otherwise we might actually end up with people trying to have more than one server running on the same port at the same time.)

What I can do, however, is add a #ifndef/#endif around the "NoReuse dummy;" statement on line 156 of "RTSPServer.cpp" - i.e., making it:

#ifndef ALLOW_RTSP_SERVER_PORT_REUSE
	NoReuse dummy;
#endif

Then, you can add
	-D ALLOW_RTSP_SERVER_PORT_REUSE=1
to the "COMPILE_OPTS =" line of your "config." file.

I hope that will work for you...

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20111028/e9d7d5e1/attachment.html>


More information about the live-devel mailing list