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);
            }
        }
        public void Close()
        {
            if (subscriber != null)
                subscriber.Close();

            subscriber = null;
        }
 public SocketStorage(TcpSocketClient client, DesktopCapture desktopCapture)
 {
     parser = new RdapMessageParser(parserStream);
     this.client = client;
     this.desktopCapture = desktopCapture;
     this.client.OnDataRecieved += OnDataRecieved;
 }
 public TcpConnection(TcpSocketClient socketClient, ISessionContext sessionContext, IRegistrator<string, IConnection> registrator)
 {
     this.socketClient = socketClient;
     this.sessionContext = sessionContext;
     this.registrator = registrator;
     this.socketClient.OnDataRecieved += OnDataRecieved;
     this.socketClient.OnExceptionThrown += OnSocketClientExceptionThrown;
 }
 public TcpMeetingBridgeAgent(TcpSocketClient socketClient)
 {
     parserStream = new FifoStream();
     parser = new RdapMessageParser(parserStream);
     connectionId = socketClient.ConnectionId;
     DoSend = true;
     this.socketClient = socketClient;
     this.socketClient.OnDataRecieved += OnDataRecieved;
     this.socketClient.OnExceptionThrown += OnException;
 }
        public void Close()
        {
            if (socketClient == null) return;

            Console.WriteLine("Closed connection, RemoteEp : " + socketClient.RemoteEndPoint + " , LocalEp : " + socketClient.LocalEndPoint);

            socketClient.OnDataRecieved -= OnDataRecieved;
            socketClient.OnExceptionThrown -= OnException;
            socketClient.Close();
            socketClient = null;
        }
        public void Close()
        {
            if (socketClient == null) return;

            registrator.Remove(socketClient.ConnectionId);

            socketClient.OnDataRecieved -= OnDataRecieved;
            socketClient.OnExceptionThrown -= OnSocketClientExceptionThrown;
            socketClient.Close();
            socketClient = null;

            sessionContext.Close();
        }
Example #8
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;
 }