Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2007-03-22
3
Medium Priority
?
1,013 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Accepted Solution

by:
meenasree earned 1000 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

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

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 …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

688 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