<html><head><base href="x-msg://2713/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div lang="EN-US" link="blue" vlink="purple"><div class="WordSection1" style="page: WordSection1; "><div style="margin-top: 0in; margin-right: 0in; margin-left: 0in; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">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.<o:p></o:p></div><div style="margin-top: 0in; margin-right: 0in; margin-left: 0in; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin-top: 0in; margin-right: 0in; margin-left: 0in; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">I had a look around and saw a previous thread regarding this issue (<a href="http://lists.live555.com/pipermail/live-devel/2011-July/013664.html" style="color: blue; text-decoration: underline; ">http://lists.live555.com/pipermail/live-devel/2011-July/013664.html</a>).</div></div></div></span></blockquote><div><br></div>Actually, this thread starts at</div><div><span class="Apple-tab-span" style="white-space:pre"> <a href="http://lists.live555.com/pipermail/live-devel/2011-July/013648.html">http://lists.live555.com/pipermail/live-devel/2011-July/013648.html</a></span></div><div>I suggest reading this entire thread to better understand the issues involved.</div><div><br></div><div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div lang="EN-US" link="blue" vlink="purple"><div class="WordSection1" style="page: WordSection1; "><div style="margin-top: 0in; margin-right: 0in; margin-left: 0in; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "> 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.<o:p></o:p></div><div style="margin-top: 0in; margin-right: 0in; margin-left: 0in; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin-top: 0in; margin-right: 0in; margin-left: 0in; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">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.</div></div></div></span></blockquote><div><br></div></div>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.)<div><br></div><div>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:</div><div><br></div><div>#ifndef ALLOW_RTSP_SERVER_PORT_REUSE</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>NoReuse dummy;</div><div>#endif</div><div><br></div><div>Then, you can add</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>-D ALLOW_RTSP_SERVER_PORT_REUSE=1</div><div>to the "COMPILE_OPTS =" line of your "config." file.</div><div><br></div><div>I hope that will work for you...</div><br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">Ross Finlayson<br>Live Networks, Inc.<br><a href="http://www.live555.com/">http://www.live555.com/</a></span></span>
</div>
<br></body></html>