Solved

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

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
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…
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…

734 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