private void updateButton_Click(object sender, EventArgs e) { if (firstMessageReceived) { customClient = new CustomClient(nameTextBox.Text); bus = Encoding.ASCII.GetBytes(String.Format("UPDATE,{0},{1}", countRQ++, customClient.ClientName)); SocketListenerThread = new Thread(new ThreadStart(SocketListener)) { IsBackground = true }; SocketListenerThread.Start(); customClient.UdpClient.Send(bus, bus.Length, servingServer); } else { serverA = new IPEndPoint(IPAddress.Parse(serverHostBox1.Text), int.Parse(serverPortBox1.Text)); serverB = new IPEndPoint(IPAddress.Parse(serverHostBox2.Text), int.Parse(serverPortBox2.Text)); customClient = new CustomClient(nameTextBox.Text); bus = Encoding.ASCII.GetBytes(String.Format("UPDATE,{0},{1}", countRQ++, customClient.ClientName)); SocketListenerThread = new Thread(new ThreadStart(SocketListener)) { IsBackground = true }; SocketListenerThread.Start(); customClient.UdpClient.Send(bus, bus.Length, serverA); customClient.UdpClient.Send(bus, bus.Length, serverB); } }
public Form1() { InitializeComponent(); GreyOutClientOperations(); customClient = new CustomClient(nameTextBox.Text); }