yokzu

yokzu

  • NA
  • 306
  • 0

Closing thread

Jan 3 2010 3:59 PM
Hi.
I am using thread function in my project. When I close program.exe(form), it is still working on background and in task manager, i can see program.exe still working.

How can I close this program completely?


public void Form1_Load(object sender, EventArgs e)
        {
            CheckForIllegalCrossThreadCalls = false;
            Thread thread_dinleyici = new Thread(new ThreadStart(dinle));
            thread_dinleyici.Start();
        }

        public void dinle()
        {
            ....
            while(true)
            {
                istemcisoketi = tcp_listener.AcceptSocket();
                if (istemcisoketi.Connected)
                {
                   ...

                    while (rdr_gonderilecek.Read())
                    {
                        gonderilecek_data += rdr_gonderilecek["iletiler"].ToString();
                    }
                    TcpClient tcp_client = new TcpClient(karsi_ip, 30001);
                    ag_akimi = tcp_client.GetStream();
                    akim_yazici = new StreamWriter(ag_akimi);
                    akim_yazici.WriteLine(gonderilecek_data);
                    akim_yazici.Flush();
                }
             
            }
 
        }

Answers (3)