private void ChatClientForm_FormClosing(object sender, FormClosingEventArgs e) { if (m_ChatClient.GetState() > 0) { WebMessage.SendString(m_ChatClient.GetSession(), "LEAVE|" + edtUser.Text); Thread.Sleep(200); } m_ChatClient.Disconnect(); }