Skip to content

Commit

Permalink
Catch TcpClient ctor exceptions in FtpWebRequest.CreateConnectionAsync (
Browse files Browse the repository at this point in the history
  • Loading branch information
stephentoub authored Jul 28, 2021
1 parent ddc729f commit 7424613
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -967,15 +967,11 @@ private Exception TranslateConnectException(Exception e)

private async void CreateConnectionAsync()
{
string hostname = _uri.Host;
int port = _uri.Port;

TcpClient client = new TcpClient();

object result;
try
{
await client.ConnectAsync(hostname, port).ConfigureAwait(false);
var client = new TcpClient();
await client.ConnectAsync(_uri.Host, _uri.Port).ConfigureAwait(false);
result = new FtpControlStream(client);
}
catch (Exception e)
Expand Down

0 comments on commit 7424613

Please sign in to comment.