Commit 99103819 authored by Mikhail Karpenko's avatar Mikhail Karpenko
Browse files

Provide dedicated port for each RTSP server

parent 2434b063
Loading
Loading
Loading
Loading
+15 −10
Original line number Diff line number Diff line
@@ -45,9 +45,11 @@ using namespace std;
#endif

#define RTSP_SIGN	              "rtsp://"
#define RTSP_PORT_1	554
#define RTSP_PORT_2	8554
#define RTSP_PRIMARY_PORT	      554
#define RTSP_SECONDARY_PORT	      8554
//#define RTSP_PORT_3	7070
/** Maximun number of pending connections for a socket */
#define MAX_CONNECTIONS           2

// TODO
_Request::_Request(const string &request) {
@@ -137,6 +139,7 @@ RTSP_Server::RTSP_Server(int (*h)(void *, RTSP_Server *, RTSP_Server::event), vo
}

void RTSP_Server::main(void) {
	int port_num;
	list<Socket *> s;
	// create listen socket...

@@ -144,12 +147,14 @@ void RTSP_Server::main(void) {
	// opened port assigned to process id and is keeped all time while process is alive
	// so, keep this socket
	if (socket_main_1 == NULL) {
		socket_main_1 = new Socket("", RTSP_PORT_1);
		socket_main_1->listen(2);
		port_num = RTSP_PRIMARY_PORT + 2 * params->get_port_num();
		socket_main_1 = new Socket("", port_num);
		socket_main_1->listen(MAX_CONNECTIONS);
	}
	if (socket_main_2 == NULL) {
		socket_main_2 = new Socket("", RTSP_PORT_2);
		socket_main_2->listen(2);
		port_num = RTSP_SECONDARY_PORT + 2 * params->get_port_num();
		socket_main_2 = new Socket("", port_num);
		socket_main_2->listen(MAX_CONNECTIONS);
	}
	/*
	 if(socket_main_3 == NULL) {