As John already said, you cannot say the thread: “please stop now” and expect the thread to obey. Thread.Abort will not say that it stops, it will simply "disable" it. :)
What I did in the past added a series of “if (wehavetostop)” inside the stream code, and if the user clicked “cancel”, I set wehavetostop == true.
This is not very elegant, and in some cases it can be “difficult” to put “if” checks, especially if your thread performs a “long” operation that you cannot split.
If you are trying to establish a network connection (and it takes time) and you really think that the “abnormal” termination of the stream will not cause any distorting state, you can use it, but remember that you cannot trust the state of things that were involved into this thread.
Martin marconcini
source share