Here is a simple patch to allow specifying a port number, e.g.<div><br></div><div>./proxyServer/live555ProxyServer -p 10001 ...</div><div><br></div><div>I often need to run multiple proxy servers on different ports, this allows to pass a port number as an argument to live555ProxyServer and I think would make a great addition if it were included in the upstream version:</div>
<div><br></div><div><div>--- a/proxyServer/live555ProxyServer.cpp</div><div>+++ b/proxyServer/live555ProxyServer.cpp</div><div>@@ -27,6 +27,7 @@ UsageEnvironment* env;</div><div> int verbosityLevel = 0;</div><div> Boolean streamRTPOverTCP = False;</div>
<div> portNumBits tunnelOverHTTPPortNum = 0;</div><div>+portNumBits rtspServerPortNum = 554;</div><div> char* username = NULL;</div><div> char* password = NULL;</div><div> </div><div>@@ -34,6 +35,7 @@ void usage() {</div>
<div> *env << "Usage: " << progName</div><div> << " [-v|-V]"</div><div> << " [-t|-T <http-port>]"</div><div>+ << " [-p <rtsp-port>]"</div>
<div> << " [-u <username> <password>]"</div><div> << " <rtsp-url-1> ... <rtsp-url-n>\n";</div><div> exit(1);</div><div>@@ -89,6 +91,21 @@ int main(int argc, char** argv) {</div>
<div> usage();</div><div> break;</div><div> }</div><div>+ </div><div>+ case 'p': {</div><div>+ // set port</div><div>+ if (argc > 3 && argv[2][0] != '-') {</div>
<div>+ // The next argument is the RTSP server port number: </div><div>+ if (sscanf(argv[2], "%hu", &rtspServerPortNum) == 1</div>
<div>+ && rtspServerPortNum > 0) {</div><div>+ ++argv; --argc;</div><div>+ break;</div><div>+ }</div><div>+ }</div><div>+ // If we get here, the option was specified incorrectly:</div>
<div>+ usage();</div><div>+ break;</div><div>+ }</div><div> </div><div> case 'u': { // specify a username and password (to be used if the 'back end' (i.e., proxied) stream requires authentication)</div>
<div> if (argc < 4) usage(); // there's no argv[3] (for the "password")</div><div>@@ -131,12 +148,11 @@ int main(int argc, char** argv) {</div><div> // access to the server.</div><div> #endif</div>
<div> </div><div>- // Create the RTSP server. Try first with the default port number (554),</div><div>+ // Create the RTSP server. Try first with the default port number (554) or the one set by the caller,</div><div>
// and then with the alternative port number (8554):</div>
<div> RTSPServer* rtspServer;</div><div>- portNumBits rtspServerPortNum = 554;</div><div> rtspServer = RTSPServer::createNew(*env, rtspServerPortNum, authDB);</div><div>- if (rtspServer == NULL) {</div><div>+ if (rtspServer == NULL && rtspServerPortNum != 554) {</div>
<div> rtspServerPortNum = 8554;</div><div> rtspServer = RTSPServer::createNew(*env, rtspServerPortNum, authDB);</div><div> }</div></div>