示例#1
0
文件: Program.cs 项目: tdav/SharpRTSP
        static void Main(string[] args)
        {
            int    port     = 8554;
            string username = "******";                  // or use NUL if there is no username
            string password = "******";              // or use NUL if there is no password

            RtspServer s = new RtspServer(port, username, password);

            s.StartListen();

            // Wait for user to terminate programme
            String msg = "Connect RTSP client to Port=" + port;

            if (username != null && password != null)
            {
                msg += " Username="******" Password="******"Press ENTER to exit");
            String readline = null;

            while (readline == null)
            {
                readline = Console.ReadLine();

                // Avoid maxing out CPU on systems that instantly return null for ReadLine
                if (readline == null)
                {
                    Thread.Sleep(500);
                }
            }

            s.StopListen();
        }
示例#2
0
        static void Main(string[] args)
        {
            RtspServer s = new RtspServer(8554);

            s.StartListen();

            // Wait for user to terminate programme
            Console.WriteLine("Press ENTER to exit");
            String dummy = Console.ReadLine();

            s.StopListen();
        }
示例#3
0
        static async Task Main(string[] args)     // 8554 192.168.1.2 admin 123
        {
            int    port     = int.Parse(args[0]); // 8554;
            string username = null;               // "user";      // or use NUL if there is no username
            string password = null;               //"password";  // or use NUL if there is no password

            RtspServer s = new RtspServer(port, username, password, args[1], int.Parse(args[2]), int.Parse(args[3]), args[4], args[5]);

            try
            {
                await s.ListenAsync();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return;
            }

            // Wait for user to terminate programme
            string msg = "Connect RTSP client to Port=" + port;

            if (username != null && password != null)
            {
                msg += " Username="******" Password="******"Press ENTER to exit");
            string readline = null;

            while (readline == null)
            {
                readline = Console.ReadLine();

                // Avoid maxing out CPU on systems that instantly return null for ReadLine
                if (readline == null)
                {
                    Thread.Sleep(500);
                }
            }

            s.StopListen();
        }
示例#4
0
        static async System.Threading.Tasks.Task Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionTrapper;

            int    port     = 8554;
            string username = "******";          // or use NUL if there is no username
            string password = "******";              // or use NUL if there is no password

            RtspServer s = new RtspServer(port, username, password);

            try {
                s.StartListenAsync();
            } catch {
                Console.WriteLine("Error: Could not start server");
                return;
            }

            // Wait for user to terminate programme
            String msg = "Connect RTSP client to Port=" + port;

            if (username != null && password != null)
            {
                msg += " Username="******" Password="******"Press ENTER to exit");
            String readline = null;

            while (readline == null)
            {
                readline = Console.ReadLine();

                // Avoid maxing out CPU on systems that instantly return null for ReadLine
                if (readline == null)
                {
                    Thread.Sleep(500);
                }
            }

            s.StopListen();
        }
示例#5
0
        static void Main(string[] args)
        {
            RtspServer s = new RtspServer(8554);

            s.StartListen();

            // Wait for user to terminate programme
            Console.WriteLine("Press ENTER to exit");
            String readline = null;

            while (readline == null)
            {
                readline = Console.ReadLine();

                // Avoid maxing out CPU on systems that instantly return null for ReadLine
                if (readline == null)
                {
                    Thread.Sleep(500);
                }
            }

            s.StopListen();
        }