private void RefreshList() { if (server != null && ServerSelect.Checked) { listView1.Items.Clear(); AddItemToList("Server", server.GetLocalIP()); var list = server.GetConnectedIP(); for (int i = 0; i < list.Count; i++) { AddItemToList("Client", list[i]); } } if (client != null && ClientSelect.Checked) { listView1.Items.Clear(); AddItemToList("Server", client.GetServerIP()); var list = client.GetConnectedIP(); if (list == null) { MessageBox.Show("Time Out"); return; } for (int i = 0; i < list.Count; i++) { AddItemToList("Client", list[i]); } } }