Solved

VB.NET Question about killing threads completely, I'm stumped.

Posted on 2007-03-22
3
1,003 Views
Last Modified: 2012-05-05
I have a thread now that establishes an internet connection and begins to handle packets, etc.

I've run the t.abort() call on the thread and set t = nothing and it appears as if the object is gone (if I call t.abort() again it gives me an object error that its not defined)

the strange thing is the connection is not terminated (i can see packets still being processed)... so I'm a bit confused

Can someone clarify to me the BEST way to totally kill a thread and everything related to it immediately?

I'm guessing that terminating the thread only kills the sub process that was called at the addressof... any way to go deeper than that?
0
Comment
Question by:mcainc
3 Comments
 
LVL 4

Accepted Solution

by:
meenasree earned 500 total points
ID: 18777949
after abort
invoke Thread.Sleep(time) for some time and see whether yr problem gets solved
0
 
LVL 11

Expert Comment

by:Babycorn-Starfish
ID: 18804885
Hi,

what are you using for the connection? If it's something like a socket wrap it in a try..catch block and just set it to null, close it  or something. The process should then drop into the catch and then exit the thread.
0
 
LVL 5

Expert Comment

by:andr_gin
ID: 23096933
If Thread.Abort ist called on unmanaged Code (for example a blocking read on a network stream) the thread is aborted after it enters the managed code again. Thread.sleep is not a solution because the time is not really known. If you you have a TCP Listener without a timeout this could be forever if noone connects. If you have a blocking read from a network stream without a timeout and the protocoll got stuck and the other side does not send anymore this also can take a long time.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
coded character set iptc field within a jpeg 1 69
Help with Query not working in client's PC 1 35
SSL https .net web site force redirect 3 36
Help with Syntax 9 26
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now