Beispiel #1
0
        public void BeginConnect()
        {
            ScreeClient.Close();
            ScreeClient = new TcpClient();
            IPEndPoint ipEndpoint = new IPEndPoint(IpV4, port);

            int  timeOut = TIMEOUT;
            bool tryConnect;

            while (true)
            {
                if (timeOut <= 0)
                {
                    tryConnect = false;
                    break;
                }

                try
                {
                    ScreeClient.Connect(ipEndpoint);
                    tryConnect = true;
                    break;
                } catch
                {
                    timeOut -= 1000;
                }

                System.Threading.Thread.Sleep(1000);
            }

            if (tryConnect == true)
            {
                SendSomeInfoOfClient(); // send again
                receive = new ReiceveManager();
                send    = new SendManager();
                receive.Receive();
                send.StartSendImageCapture();
                NotifyMessage.showMessage("Screen Client is connect again success", 1, 3000);
            }
            else
            {
                //Exit
                NotifyMessage.showMessage("Screen Client is exitting ...", 2, 3000);
                Environment.Exit(0);
                Application.Exit();
            }
        }
Beispiel #2
0
        private void ok_btt_Click(object sender, EventArgs e)
        {
            client  = new Client();
            send    = new SendManager();
            receive = new ReiceveManager();
            bool result = client.SetClientProperty(ipv4_tb.Text, port_tb.Text, screenList.SelectedIndex, modeList.SelectedItem.ToString(), userIndexList.SelectedItem.ToString(), infomation_tb.Text);

            if (result == false)
            {
                MessageBox.Show("Xem lại định dạng ipv4 và port, port phải là số nguyên dương < 10000. Hãy chắc chắn bạn đã điền hết các ô trống");
            }
            else
            {
                client.CreateClient();
                send.StartSendImageCapture();
                receive.Receive();

                ShowAppinNotifyIcon();
            }
        }