private void button1_Click(object sender, EventArgs e) { if (this.client == null) { int myPort = int.Parse(this.textBox1.Text); string remoteIP = this.textBox2.Text; int remotePort = int.Parse(this.textBox3.Text); this.client = new UDP_CLIENT_AUT(); this.client.DataReceived += this.DataReceived; this.client.makenewclient += this.NewClient; this.button2.Enabled = true; this.button1.Text = "disconnect"; } else { this.client.Close(); this.button2.Enabled = false; this.button1.Text = "Connect"; } }