private void strt_btn_Click(object sender, EventArgs e) { if (AvailablePlayers.SelectedIndex != -1) { using (Client client = new Client()) { NetworkStream ns = client.Connect(ips[AvailablePlayers.SelectedIndex]); client.Write(ns, Player.Name); string data = client.Read(ns); data = data.Substring(0, data.IndexOf('\0')); if (data == "&|&") { MessageBox.Show("Sorry this player is busy", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); ns.Close(); } else { Player.IsServer = false; //Starting Game Game game = new Game(ns, names[AvailablePlayers.SelectedIndex]); game.Show(); Close(); } } } else MessageBox.Show("Please Select Any Player", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); }