Example #1
0
        private void polacz_Click(object sender, EventArgs e)
        {
            Ip = IPAddress.Parse(ipTextArea.Text).ToString();
            if (!Connected)
            {
                _clientTCP.Tcp.Connect(Ip, Port);
                Connected = true;
                MessageReader.RunWorkerAsync();
            }
            /*	The	connecton IS set & trying to disconnect	*/
            else
            {
                MessageReader.CancelAsync();
                polacz.Enabled = false;
                _clientTCP.Tcp.Close();
                Connected  = false;
                _clientTCP = new TCP();
            }

            polacz.Text = Connected ? "Rozlacz" : "Polacz";
            if (!Connected)
            {
                return;
            }
            Thread.Sleep(1000);
            SendMsg(@"getRelay()");
        }