Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
3.5k views
in .NET FTP by (1.2k points)
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

3 Answers

0 votes
by (162k points)
conn.Close(true) will force a close on your connections.
0 votes
by (1.2k points)
.Close(true) did not work either. Any other possible solutions?

Thanks,
0 votes
by (162k points)
Skip the IsConnected test and just call Close(true) on all connections to ensure they are closed.

Then email us the segment of the log file containing the attempts to close.

Categories

...