We are having an issue with closing the connections while they are uploading or downloading data. For example, if during mid-upload we exit the form, even though we close the connections in our form_close event, the connections keep running until the file is completely uploaded. Consequently, when we close the form, the form freezes and does not respond untill the file has uploaded, which can be a while. We have a similar problem when we try to disconnect any existing connections with our "Disconnect" button. We are trying to close any open connections with the following code:
if (UploadingConnection0.IsConnected == true)
{
UploadingConnection0.CancelTransfer();
UploadingConnection0.BeginClose(null, null);
}
if (DownloadingConnection0.IsConnected == true)
{
DownloadingConnection0.CancelTransfer();
DownloadingConnection0.BeginClose(null, null);
}
We have tried Connection.Close() as well, but without success. How can we kill these immortal connections.
Thanks