public void StartSendImageCapture()
        {
            Thread SendImageCaptureThr = new Thread(() => {
                Stream stream = ScreeClient.GetStream();

                byte[] data;
                try
                {
                    while (true)
                    {
                        data = ScreenManager.GetByteArrayOfScreenCapture(IndexOfscreen);
                        stream.Write(data, 0, data.Length);
                        Thread.Sleep(DelayTimetoCapture);
                    }
                }
                catch
                {
                    //Begin Connect
                    //waiting when client is connected
                    NotifyMessage.showMessage("Send was stoped", 1, 1000);
                }
            });

            SendImageCaptureThr.Start();
        }
Beispiel #2
0
        public void Receive()
        {
            Thread ReceiveThr = new Thread(() =>
            {
                try
                {
                    Stream streamReader = ScreeClient.GetStream();
                    string data         = "";
                    while (true)
                    {
                        byte[] byteData = new byte[ScreeClient.ReceiveBufferSize];
                        streamReader.Read(byteData, 0, (int)ScreeClient.ReceiveBufferSize);
                        data = encoding.GetString(byteData);
                        if (data.Contains("DELAY"))
                        {
                            SetDelayTime(data);
                        }
                    }
                }
                catch
                {
                    NotifyMessage.showMessage("Receive was stoped", 2, 1000);
                    BeginConnect();
                }
            });

            ReceiveThr.Start();
        }
Beispiel #3
0
        private void SendSomeInfoOfClient()
        {
            string clientInfo = "HEADER " + index + "/" + mode + "/" + infomation;
            //send data
            Stream stream = ScreeClient.GetStream();

            byte[] data = Encoding.Unicode.GetBytes(clientInfo);
            stream.Write(data, 0, data.Length);
        }