Example #1
0
        private void bt_get_qus_Click(object sender, EventArgs e)
        {
            try
            {
                //epremote = new IPEndPoint(IPAddress.Parse("10.0.0.2"), Convert.ToInt32("12000"));
                //10.100.220.33
                clientSocket.Connect(Variable.ipaddress, Variable.port);
                STR_W           = new StreamWriter(clientSocket.GetStream());
                STR_R           = new StreamReader(clientSocket.GetStream());
                STR_W.AutoFlush = true;
                if (clientSocket.Connected)
                {
                    STR_W.WriteLine("Get_Sec_Qus|" + txt_username.Text);

                    string returndata;

                    returndata = STR_R.ReadLine();


                    if (returndata == "Username Not Exists")
                    {
                        MessageBox.Show("Username Doesnot exists.....!");

                        this.Hide();
                        ForgotPassword form2 = new ForgotPassword();
                        form2.Closed += (s, args) => this.Close();
                        form2.Show();
                    }
                    else
                    {
                        string[] data1 = returndata.Split('|');
                        txt_qus.Text = data1[1];
                        Sec_Qus_ans  = data1[2];
                        Sec_passwd   = data1[3];
                        clientSocket.Close();
                    }
                }
                // clientSocket.Close();
            }


            catch (Exception e4)
            {
                clientSocket.Close();
                Console.WriteLine(e4.ToString());
            }
        }