Example #1
0
        private void browserButton_Click(object sender, EventArgs e)
        {
            mPipe = new System.IO.Pipes.NamedPipeServerStream("bbtest", System.IO.Pipes.PipeDirection.InOut, 1, System.IO.Pipes.PipeTransmissionMode.Message, System.IO.Pipes.PipeOptions.Asynchronous);
            System.Diagnostics.Process.Start(Application.ExecutablePath, "bbtest");
            pipeBuffer = new byte[4096];
            SessionForm ss = new SessionForm();

            userForms.Add("/" + ss.Value.ToString(), ss);
            ss.Show(this);
            ((System.IO.Pipes.NamedPipeServerStream)mPipe).BeginWaitForConnection(WaitForConnectionSink, ss);
        }
Example #2
0
        private async void StartClient()
        {
            SessionForm ss = new SessionForm();
            userForms.Add("/" + ss.Value.ToString(), ss);
            ss.Show(this);

            string offer = await ss.Connection.GenerateOffer();
            byte[] b = UTF8Encoding.UTF8.GetBytes(offer);
            mPipe.Write(b, 0, b.Length);
            StartRead(ss);
        }
Example #3
0
        private async void StartClient()
        {
            SessionForm ss = new SessionForm();

            userForms.Add("/" + ss.Value.ToString(), ss);
            ss.Show(this);

            string offer = await ss.Connection.GenerateOffer();

            byte[] b = UTF8Encoding.UTF8.GetBytes(offer);
            mPipe.Write(b, 0, b.Length);
            StartRead(ss);
        }
Example #4
0
        private void GetNewPOC(IPEndPoint from, WebRTCCommons.CustomAwaiter <byte[]> awaiter)
        {
            BeginInvoke((Action <IPEndPoint, WebRTCCommons.CustomAwaiter <byte[]> >)((origin, a) =>
            {
                SessionForm f = new SessionForm();
                if (StunServersInUse)
                {
                    f.SetStunServers(false, StunServers);
                }
                f.FormClosing += SessionFormClosing;
                f.Show(this);

                userForms.Add("/" + f.Value.ToString(), f);

                string content = htmlpage.Replace("/*{{{ICESERVERS}}}*/", "").Replace("{{{OFFER_URL}}}", origin.Address.ToString() + ":" + mServer.Port.ToString() + "/" + f.Value.ToString());
                string header  = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nConnection: close\r\nContent-Length: " + content.Length.ToString() + "\r\n\r\n";
                a.SetComplete(UTF8Encoding.UTF8.GetBytes(header + content));
            }), from, awaiter);
        }
Example #5
0
        private void GetNewPassivePOC(WebRTCCommons.CustomAwaiter <byte[]> awaiter)
        {
            BeginInvoke((Action <WebRTCCommons.CustomAwaiter <byte[]> >)(async(a) =>
            {
                SessionForm f = new SessionForm();
                if (StunServersInUse)
                {
                    f.SetStunServers(false, StunServers);
                }
                f.FormClosing += SessionFormClosing;
                f.Show(this);

                userForms.Add("/" + f.Value.ToString(), f);

                string content = passiveHtmlpage.Replace("/*{{{ICESERVERS}}}*/", "").Replace("{{{OFFER_URL}}}", "127.0.0.1:" + mServer.Port.ToString() + "/" + f.Value.ToString());
                string sdp     = await f.GetOffer();

                content = content.Replace("/*{{{SDP}}}*/", System.Convert.ToBase64String(UTF8Encoding.UTF8.GetBytes(sdp)));

                string header = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nConnection: close\r\nContent-Length: " + content.Length.ToString() + "\r\n\r\n";
                a.SetComplete(UTF8Encoding.UTF8.GetBytes(header + content));
            }), awaiter);
        }
Example #6
0
        private void GetNewPassivePOC(WebRTCCommons.CustomAwaiter<byte[]> awaiter)
        {
            BeginInvoke((Action<WebRTCCommons.CustomAwaiter<byte[]>>)(async (a) =>
                {
                    SessionForm f = new SessionForm();
                    if (StunServersInUse) { f.SetStunServers(false, StunServers); }
                    f.FormClosing += SessionFormClosing;
                    f.Show(this);

                    userForms.Add("/" + f.Value.ToString(), f);

                    string content = passiveHtmlpage.Replace("/*{{{ICESERVERS}}}*/", "").Replace("{{{OFFER_URL}}}", "127.0.0.1:" + mServer.Port.ToString() + "/" + f.Value.ToString());
                    string sdp = await f.GetOffer();

                    content = content.Replace("/*{{{SDP}}}*/", System.Convert.ToBase64String(UTF8Encoding.UTF8.GetBytes(sdp)));

                    string header = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nConnection: close\r\nContent-Length: " + content.Length.ToString() + "\r\n\r\n";
                    a.SetComplete(UTF8Encoding.UTF8.GetBytes(header + content));
                }), awaiter);
        }
Example #7
0
 private void browserButton_Click(object sender, EventArgs e)
 {
     mPipe = new System.IO.Pipes.NamedPipeServerStream("bbtest", System.IO.Pipes.PipeDirection.InOut, 1, System.IO.Pipes.PipeTransmissionMode.Message, System.IO.Pipes.PipeOptions.Asynchronous);
     System.Diagnostics.Process.Start(Application.ExecutablePath, "bbtest");
     pipeBuffer = new byte[4096];
     SessionForm ss = new SessionForm();
     userForms.Add("/" + ss.Value.ToString(), ss);
     ss.Show(this);
     ((System.IO.Pipes.NamedPipeServerStream)mPipe).BeginWaitForConnection(WaitForConnectionSink, ss);
 }
Example #8
0
        private void GetNewPOC(IPEndPoint from, WebRTCCommons.CustomAwaiter<byte[]> awaiter)
        {
            BeginInvoke((Action<IPEndPoint, WebRTCCommons.CustomAwaiter<byte[]>>)((origin, a) =>
                {
                    SessionForm f = new SessionForm();
                    if (StunServersInUse) { f.SetStunServers(false, StunServers); }
                    f.FormClosing += SessionFormClosing;
                    f.Show(this);

                    userForms.Add("/" + f.Value.ToString(), f);

                    string content = htmlpage.Replace("/*{{{ICESERVERS}}}*/", "").Replace("{{{OFFER_URL}}}", origin.Address.ToString() + ":" + mServer.Port.ToString() + "/" + f.Value.ToString());
                    string header = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nConnection: close\r\nContent-Length: " + content.Length.ToString() + "\r\n\r\n";
                    a.SetComplete(UTF8Encoding.UTF8.GetBytes(header + content));
                }), from, awaiter);

        }