By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,219 Members | 2,423 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,219 IT Pros & Developers. It's quick & easy.

thread won't stop

P: n/a
LS
Hello,

I have a windowsforms application which spins a new thread.

Code of the thread
-----------------------------------------------------------------
Sub DoListen()
Dim listener As TcpListener
Dim tcpclient As TcpClient
Try
listener = New TcpListener(System.Net.IPAddress.Any, 9524)
listener.Start()
Do
tcpclient = listener.AcceptTcpClient()
Threading.ThreadPool.QueueUserWorkItem(AddressOf
HandleTcpClient, tcpclient)
Loop Until frmmain.running = False
Catch ex As Exception
Console.WriteLine(" " + ex.Message)
End Try
End Sub

-----------------------------------------------------------------

If I try to stop the thread or if I quit my program the thread keeps on
running.
If I debug the program and pause the thread the program always pauses on the
line :
-> tcpclient = listener.AcceptTcpClient()

Any ideas on how to solve this problem?

Regards
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
LS,

Simple give before you start the thread this option. (IsBackGround)

http://msdn.microsoft.com/library/de...roundtopic.asp

I hope this helps,

Cor
Nov 21 '05 #2

P: n/a
LS
>
Simple give before you start the thread this option. (IsBackGround)

http://msdn.microsoft.com/library/de...roundtopic.asp

I hope this helps,


This seems to work, thanks a lot
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.