<HTML>
<HEAD>
<TITLE>[PATCH] Added command line option to live555MediaServer to specify port</TITLE>
</HEAD>
<BODY>
<FONT FACE="Lucida Console"><SPAN STYLE='font-size:11pt'>Hi everyone,<BR>
<BR>
I’ve added some code into live555MediaServer.cpp to allow the user to specify a command line argument stating which port to use for the server. This change allows multiple (more than 2) live555MediaServers to be started on a given host and means they can also be started using a script. If no port is specified I’ve set the server to start on port 8554. This is perhaps not everybody’s default but suits our environment.<BR>
<BR>
Kind regards,<BR>
<BR>
Mark Liggett<BR>
BTI Systems<BR>
<BR>
24d23<BR>
< #include <unistd.h><BR>
40,78d38<BR>
< /*<BR>
< * Added command line option -p <portnumber> to specify a tcp port on<BR>
< * which to start live555MediaServer otherwise default to port 8554<BR>
< */<BR>
< unsigned short desiredPortNum = 8554;<BR>
< int opt;<BR>
< <BR>
< if(argc == 1){<BR>
< *env << "RTSP server starting on default port: " << desiredPortNum << "\n";<BR>
< }<BR>
< <BR>
< while ((opt = getopt (argc, argv, "p:")) != -1) {<BR>
< switch (opt)<BR>
< {<BR>
< case 'p': { // specify port number<BR>
< int portArg;<BR>
< if(sscanf(optarg, "%d", &portArg) != -1){<BR>
< if (portArg <= 0 || portArg >= 65536) {<BR>
< *env << "RTSP server failed to start: " << "Invalid port number \n";<BR>
< exit(1);<BR>
< }<BR>
< else{<BR>
< desiredPortNum = (unsigned short)portArg;<BR>
< *env << "RTSP server starting on port: " << desiredPortNum << "\n";<BR>
< break;<BR>
< }<BR>
< }<BR>
< else{<BR>
< *env << "RTSP server failed to start: " << "Invalid port number \n";<BR>
< exit(1);<BR>
< }<BR>
< }<BR>
< default : {<BR>
< *env << "RTSP server failed to start: " << "Missing port number \n";<BR>
< exit(1);<BR>
< }<BR>
< }<BR>
< }<BR>
< <BR>
82,86c42<BR>
< <BR>
< // Changed default behavior to set port to desiredPortNum rather than 554<BR>
< portNumBits rtspServerPortNum = desiredPortNum;<BR>
< <BR>
< <BR>
---<BR>
> portNumBits rtspServerPortNum = 554;<BR>
88,91d43<BR>
< <BR>
< /*<BR>
< * Removed to stop default port behavior<BR>
< *<BR>
96,97d47<BR>
< */<BR>
< </SPAN></FONT>
</BODY>
</HTML>