L
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
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