S
S
SilentBlock2019-04-05 16:29:00
C++ / C#
SilentBlock, 2019-04-05 16:29:00

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

1 answer(s)
S
shai_hulud, 2019-04-05
@shai_hulud

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 question

Ask a Question

731 491 924 answers to any question