Default ports for FTP
By default FTP uses port 21 for control channel:
// C# version
using (Ftp client = new Ftp())
{
client.Connect("ftp.example.org");
//...
client.Close();
}
' VB.NET version
Using client As New Ftp()
client.Connect("ftp.example.org")
'...
client.Close()
End Using
By default FTPS uses port 990 for control channel:
// C# version
using (Ftp client = new Ftp())
{
client.ConnectSSL("ftp.example.org");
//...
client.Close();
}
' VB.NET version
Using client As New Ftp()
client.ConnectSSL("ftp.example.org")
'...
client.Close()
End Using
If your FTP or FTPS server is running on different port just use overladed version of Connect and ConnectSSL:
// C# version
client.Connect("ftp.example.org", 999);
client.ConnectSSL("ftp.example.org", 999);
' VB.NET version
client.Connect("ftp.example.org", 999)
client.ConnectSSL("ftp.example.org", 999)