Esempio n. 1
0
        static void Main(string[] args)
        {
            RtmpServer server = new RtmpServerBuilder()
                                .UseStartup <Startup>()
                                .UseWebSocket(c =>
            {
                c.BindEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 8080);
            })
                                .Build();
            var tsk = server.StartAsync();

            tsk.Wait();
        }
Esempio n. 2
0
        static async System.Threading.Tasks.Task Main(string[] args)
        {
            RtmpServer server = new RtmpServerBuilder()
                                .UseStartup <Startup>()
                                .CheckNameAndPwd((username, pwd) =>
            {
                if (!"123456".Equals(pwd))
                {
                    OnlineObj.ClinetIOPipeLines[username].Disconnect();
                    return(false);
                }
                else
                {
                    return(true);
                }
            })
                                .BackIOPipeLine((username, x) =>
            {
                if (OnlineObj.ClinetIOPipeLines.ContainsKey(username))
                {
                    OnlineObj.ClinetIOPipeLines[username].Disconnect();
                    OnlineObj.ClinetIOPipeLines[username] = x;
                }
                else
                {
                    OnlineObj.ClinetIOPipeLines.Add(username, x);
                }
                return(true);
            })
                                .UseWebSocket(c =>
            {
                c.BindEndPoint = new IPEndPoint(IPAddress.Parse("192.168.1.12"), 8080);
            })
                                .Build();
            var tsk = server.StartAsync();

            tsk.Wait();
            // Pipe pipe = new Pipe();

            // await WriteSomeDataAsync(pipe.Writer);
            // pipe.Writer.Complete();
            // await ReadSomeDataAsync(pipe.Reader);
        }