Answer the question
In order to leave comments, you need to log in
How to terminate connection from WebClient?
A simple upload to the server:
WebClient wc = new WebClient();
string fullname = " ftp://xxxxxxxxxxx/ " + ShotPath + ShotName;
try
{
wc.UploadFile(fullname, ShotName);
}
catch { }
wc.Dispose();
By default, apparently, KeepAlive is set in WebClient and, accordingly, these connections are accumulated in the cycle and the program crashes when the max. number of FTP connections.
How to disable this KeepAlive?
Answer the question
In order to leave comments, you need to log in
You can use ftpwebrequest to set "KeepAlive" and "ServicePoint" in it, or explicitly terminate the connection.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question