[Live-devel] [PATCH] Added command line option to live555MediaServer to specify port
Mark Liggett
mliggett at btisystems.com
Wed Sep 30 09:47:32 PDT 2009
Hi everyone,
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.
Kind regards,
Mark Liggett
BTI Systems
24d23
< #include <unistd.h>
40,78d38
< /*
< * Added command line option -p <portnumber> to specify a tcp port on
< * which to start live555MediaServer otherwise default to port 8554
< */
< unsigned short desiredPortNum = 8554;
< int opt;
<
< if(argc == 1){
< *env << "RTSP server starting on default port: " << desiredPortNum << "\n";
< }
<
< while ((opt = getopt (argc, argv, "p:")) != -1) {
< switch (opt)
< {
< case 'p': { // specify port number
< int portArg;
< if(sscanf(optarg, "%d", &portArg) != -1){
< if (portArg <= 0 || portArg >= 65536) {
< *env << "RTSP server failed to start: " << "Invalid port number \n";
< exit(1);
< }
< else{
< desiredPortNum = (unsigned short)portArg;
< *env << "RTSP server starting on port: " << desiredPortNum << "\n";
< break;
< }
< }
< else{
< *env << "RTSP server failed to start: " << "Invalid port number \n";
< exit(1);
< }
< }
< default : {
< *env << "RTSP server failed to start: " << "Missing port number \n";
< exit(1);
< }
< }
< }
<
82,86c42
<
< // Changed default behavior to set port to desiredPortNum rather than 554
< portNumBits rtspServerPortNum = desiredPortNum;
<
<
---
> portNumBits rtspServerPortNum = 554;
88,91d43
<
< /*
< * Removed to stop default port behavior
< *
96,97d47
< */
<
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20090930/7a8e7d33/attachment-0001.html>
More information about the live-devel
mailing list