Пример #1
0
        private Task <object> QueueCommandAsTask(Command command, int streamId, int messageStreamId)
        {
            if (this.IsDisconnected)
            {
                return(RtmpProxySource.CreateExceptedTask((Exception) new ClientDisconnectedException("disconnected")));
            }
            Task <object> task = this._callbackManager.Create(command.InvokeId);

            this._writer.Queue((RtmpEvent)command, streamId, messageStreamId);
            return(task);
        }
Пример #2
0
        private void OnClientAccepted(IAsyncResult ar)
        {
            TcpListener asyncState = ar.AsyncState as TcpListener;

            try
            {
                TcpClient client = asyncState.EndAcceptTcpClient(ar);
                if (!client.Connected)
                {
                    return;
                }
                this._source = new RtmpProxySource(this._serializationContext, this.GetRtmpStream(client));
                this._source.RemotingMessageReceived += new EventHandler <RemotingMessageReceivedEventArgs>(this.OnRemotingMessageReceived);
                this._source.CommandMessageReceived  += new EventHandler <CommandMessageReceivedEventArgs>(this.OnCommandMessageReceived);
                this._source.ConnectMessageReceived  += new EventHandler <ConnectMessageEventArgs>(this.OnConnectMessageReceived);
                this._source.Disconnected            += new EventHandler(this.OnClientDisconnected);
            }
            catch (ObjectDisposedException ex)
            {
            }
        }
Пример #3
0
        private void OnClientAccepted(IAsyncResult ar)
        {

            TcpListener listener = ar.AsyncState as TcpListener;
            try
            {
                TcpClient client = listener.EndAcceptTcpClient(ar);
                if (!client.Connected)
                    return;
                var stream = GetRtmpStream(client);

                _source = new RtmpProxySource(_serializationContext, stream);
                _source.RemotingMessageReceived += OnRemotingMessageReceived;
                _source.CommandMessageReceived += OnCommandMessageReceived;
                _source.ConnectMessageReceived += OnConnectMessageReceived;
                _source.Disconnected += OnClientDisconnected;
                
            }
            catch (ObjectDisposedException)
            {
                //disconnect
            }
        }
Пример #4
0
        private void OnClientAccepted(IAsyncResult ar)
        {
            var listener = ar.AsyncState as TcpListener;

            try
            {
                var client = listener.EndAcceptTcpClient(ar);
                if (!client.Connected)
                {
                    return;
                }
                var stream = GetRtmpStream(client);

                _source = new RtmpProxySource(_serializationContext, stream);
                _source.RemotingMessageReceived += OnRemotingMessageReceived;
                _source.CommandMessageReceived  += OnCommandMessageReceived;
                _source.ConnectMessageReceived  += OnConnectMessageReceived;
                _source.Disconnected            += OnClientDisconnected;
            }
            catch (ObjectDisposedException)
            {
                //disconnect
            }
        }