M
Matthew Speed
I've written a TCP/IP server. The main loop in the code looks like
this:
While Not shutdown
Console.WriteLine("Listening for connection...")
Dim svrsocketforclient As Socket = tcpl.AcceptSocket
svrsocketforclientthread = svrsocketforclient
Console.WriteLine("Connection from {0} at {1}",
svrsocketforclient.RemoteEndPoint, Now())
Dim clientthread As Thread = New Thread(AddressOf
createclientthread)
clientthread.Start()
End While
Thsi works great. Clients connect, threads spawn and go off and do
work. The problem I have is I cannot figure out how to get the
threads to rejoin once they are done. My clients gracefully log off
and I execute a .Close method at the end of the thread code but then
it just goes into limbo. As a result the app uses more and more CPU
cycles until my 2.4 Ghz P4 feels like a 286.
Any help would be greatly appreciated.
this:
While Not shutdown
Console.WriteLine("Listening for connection...")
Dim svrsocketforclient As Socket = tcpl.AcceptSocket
svrsocketforclientthread = svrsocketforclient
Console.WriteLine("Connection from {0} at {1}",
svrsocketforclient.RemoteEndPoint, Now())
Dim clientthread As Thread = New Thread(AddressOf
createclientthread)
clientthread.Start()
End While
Thsi works great. Clients connect, threads spawn and go off and do
work. The problem I have is I cannot figure out how to get the
threads to rejoin once they are done. My clients gracefully log off
and I execute a .Close method at the end of the thread code but then
it just goes into limbo. As a result the app uses more and more CPU
cycles until my 2.4 Ghz P4 feels like a 286.
Any help would be greatly appreciated.