Ejemplo n.º 1
0
        async void mConnection_OnConnected(WebRTCConnection sender)
        {
            mConnected = true;
            await this.ContextSwitchToMessagePumpAsync(); // Switch to UI Thread so we can modify the UI

            messageTextBox.Text += ("Connected at " + DateTime.Now.ToShortTimeString() + "\r\n");
            messageTextBox.Select(messageTextBox.Text.Length, 0);

            WebRTCDataChannel dc = await sender.CreateDataChannel("MyDataChannel"); // Wait to see if this is ACK'ed

            if (dc != null)
            {
                // YUP
                mData = dc;
                mData.OnStringReceiveData += mData_OnStringReceiveData;
                mData.OnClosing           += mData_OnClosing;
            }

            await this.ContextSwitchToMessagePumpAsync(); // Switch to UI thread so we can modify the UI... (The last await may have switched us to the WebRTC thread)

            messageTextBox.Text += ("Local DataChannel Creation (MyDataChannel) was " + (dc != null ? "ACKed" : "NOT ACKed") + "\r\n");
            messageTextBox.Select(messageTextBox.Text.Length, 0);
            if (dc != null)
            {
                inputTextBox.Enabled = true; // Only setting if true, because there could already be a dataChannel that has already enabled the textbox
            }
        }
Ejemplo n.º 2
0
        private async void DebugForm_Load(object sender, EventArgs e)
        {
            mDataChannel = await mConnection.CreateDataChannel("DebugChannel");

            //mConnection._Debug_SetLossPercentage(5);

            await this.ContextSwitchToMessagePumpAsync();

            if (mDataChannel == null)
            {
                Text = "WebRTC Debug View  -  Error";
                return;
            }

            Text = "WebRTC Debug View  -  Connected";
            //mConnection.DebugEvents_OnReceiverCredits += mConnection_DebugEvents_OnReceiverCredits;
            mConnection.DebugEvents_OnSendFastRetry += mConnection_DebugEvents_OnSendFastRetry;
            mConnection.DebugEvents_OnSendRetry     += mConnection_DebugEvents_OnSendRetry;
            mConnection.DebugEvents_OnHold          += mConnection_DebugEvents_OnHold;
            mConnection.OnConnectionSendOk          += mConnection_OnConnectionSendOk;
            mConnection.DebugEvents_OnCongestionWindowSizeChanged += mConnection_DebugEvents_OnCongestionWindowSizeChanged;

            mConnection.DebugEvents_OnFastRecovery += mConnection_DebugEvents_OnFastRecovery;
            //mConnection.DebugEvents_OnRTTCalculated += mConnection_DebugEvents_OnRTTCalculated;
            mConnection.DebugEvents_OnT3RTX += mConnection_DebugEvents_OnT3RTX;
            //mConnection.DebugEvents_OnTSNFloorNotRaised += mConnection_DebugEvents_OnTSNFloorNotRaised;

            //mConnection.DebugEvents_OnSACKReceived += mConnection_DebugEvents_OnSACKReceived;

            StartSendingJunk();
        }
Ejemplo n.º 3
0
        async void mConnection_OnConnected(WebRTCConnection sender)
        {
            mConnected = true;
            BeginInvoke((Action)(() =>
            {
                messageTextBox.Text += ("Connected at " + DateTime.Now.ToShortTimeString() + "\r\n");
                messageTextBox.Select(messageTextBox.Text.Length, 0);
            }));

            WebRTCDataChannel dc = await sender.CreateDataChannel("MyDataChannel"); // Wait to see if this is ACK'ed

            if (dc != null)
            {
                // YUP
                mData = dc;
                mData.OnStringReceiveData += mData_OnStringReceiveData;
                mData.OnClosing           += mData_OnClosing;
            }

            BeginInvoke(((Action <WebRTCDataChannel>)((d) =>
            {
                messageTextBox.Text += ("Local DataChannel Creation (MyDataChannel) was " + (d != null ? "ACKed" : "NOT ACKed") + "\r\n");
                messageTextBox.Select(messageTextBox.Text.Length, 0);
                if (d != null)
                {
                    inputTextBox.Enabled = true;     // Only setting if true, because there could already be a dataChannel that has already enabled the textbox
                }
            })), dc);
        }
Ejemplo n.º 4
0
        async void mConnection_OnConnected(WebRTCConnection sender)
        {
            mConnected = true;
            await this.ContextSwitchToMessagePumpAsync(); // Switch to UI Thread so we can modify the UI
            messageTextBox.Text += ("Connected at " + DateTime.Now.ToShortTimeString() + "\r\n");
            messageTextBox.Select(messageTextBox.Text.Length, 0);
            
            WebRTCDataChannel dc = await sender.CreateDataChannel("MyDataChannel"); // Wait to see if this is ACK'ed
            if (dc != null) 
            {
                // YUP
                mData = dc;
                mData.OnStringReceiveData += mData_OnStringReceiveData;
                mData.OnClosing += mData_OnClosing;
            }

            await this.ContextSwitchToMessagePumpAsync(); // Switch to UI thread so we can modify the UI... (The last await may have switched us to the WebRTC thread)
            messageTextBox.Text += ("Local DataChannel Creation (MyDataChannel) was " + (dc!=null ? "ACKed" : "NOT ACKed") + "\r\n");
            messageTextBox.Select(messageTextBox.Text.Length, 0);
            if (dc!=null)
            {
                inputTextBox.Enabled = true; // Only setting if true, because there could already be a dataChannel that has already enabled the textbox
            }         
        }