multithreading - C# Stopping TCP File Transfer -


I'm using TcpListener and TcpClient on the sender side on the Simple TCP File Transfer receiver side. I have 2 options - synchronous or asynchronous If I use synchronization, then I have to put methods of sending / receiving methods in the background, in order to prevent stopping the bacterial thread. Asynchronnous version is without problems ...

My question is, how to stop moving file transfer?

In the synchronous version I tried to use the BackgroundWorker.CancelAsync () method, and check the Background Walker in each loop illustration. Cancellation family property, but it does not look like this (cancellation is probably not setting the cancellation setting): (

In the asynchronnous version I tried to use the volatile variable indicator and its value in each callback The problem is, when I change it to the Stop () method, and in the callback it also changes with callback, its previous value reads: (

< Div class = "post-text" itemprop = "text">

Cancel Nskank should work, what you set:

  backgroundWorker.WorkerSupports cancellation = true:  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -