Solved

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

Posted on 2007-03-22
3
1,009 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 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

Setting up LaraDock for Laravel

Learn how to set up LaraDock in a Laravel project - LaraDock gives us an easy way to run a Laravel application using Docker in a single command.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month10 days, 9 hours left to enroll

632 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