Example #1
0
        static void Main()
        {
            Console.Write("Enter IP Address : ");
            var strIPAddress = Console.ReadLine();

            Console.Write("Enter Port : ");
            var strPort = Console.ReadLine();
            var port = int.Parse(strPort);

            var publisher = new TcpSocketClient(8000);
            publisher.Connect(new IPEndPoint(IPAddress.Parse(strIPAddress), port));

            var dCapture = new DesktopCapture(PixelFormat.Format24bppRgb, new Size(640, 400));

            var ss = new SocketStorage(publisher, dCapture);

            Console.WriteLine("Press Enter To Start streaming....");

            Console.ReadLine();

            Console.WriteLine("Press any Key To Exit....");

            while (_kbhit() == 0)
            {
                var frame = dCapture.Execute();
                ss.Process(frame);
            }
        }
Example #2
0
        static void Main()
        {
            var publisher = new TcpSocketClient(8000);
            publisher.Connect(new IPEndPoint(IPAddress.Loopback, 5000));

            var cam = new VideoCapture(0, 15, 160, 120);
            cam.Start();

            Console.ReadLine();

            for (var i = 0; i < 200000000; i++)
            {
                var ip = cam.GetBitMap();
                var image = new Bitmap(cam.Width, cam.Height, cam.Stride, PixelFormat.Format24bppRgb, ip);
                image.RotateFlip(RotateFlipType.RotateNoneFlipY);
                var frame = RgbFrameFactory.CreateFrame(image);
                var message = new VideoFrameMessage(RdapImagePixelFormatType.PIX_FMT_RGB24, (uint)frame.Width, (uint)frame.Height, frame.Data);
                var dataToSend = new RdapMessage(RdapMessageType.VideoFrameMessage, message.ToBytes()).ToBytes();
                publisher.Send(dataToSend, 0, dataToSend.Length);
                image.Dispose();
            }

            Console.ReadLine();
        }
 private void play(object sender, EventArgs e)
 {
     if (subscriber != null) return;
     subscriber = new TcpSocketClient(8000);
     subscriber.Connect(new IPEndPoint(IPAddress.Parse(textBox1.Text), int.Parse(textBox2.Text)));
     subscriber.OnDataRecieved += OnDataRecieved;
 }