Specify different port for FTP
With Ftp.dll .NET FTP component establishing connection using default port is easy:
// C#
client.Connect("ftp.example.com");
' VB.NET
client.Connect("ftp.example.com")
If you need to specify different port just use overloaded version of Connect method:
// C#
client.Connect("ftp.example.com", 999);
// -or-
client.Connect("ftp.example.com", 999, false);
' VB.NET
client.Connect("ftp.example.com", 999)
' -or-
client.Connect("ftp.example.com", 999, False)
If you are using SSL:
// C#
client.ConnectSSL("ftp.example.com", 999);
// -or-
client.Connect("ftp.example.com", 999, true);
' VB.NET
client.ConnectSSL("ftp.example.com", 999)
' -or-
client.Connect("ftp.example.com", 999, True)
You can also specify the port range used in Active mode.
// C# client.ActiveModePorts = new Range(1024, 1025);
' VB.NET client.ActiveModePorts = New Range(1024, 1025)
You can set the IP address announced to the FTP server in Active mode data transfer.
By default, the value of this property is IPAddress.None which means that the address of the network interface is used instead.
// C#
client.ActiveModeAddress = IPAddress.Parse("ftp.example.com");
' VB.NET
client.ActiveModeAddress = IPAddress.Parse("ftp.example.com")