Invece di usarne uno gia pronto, per buttare via un po'
di tempo ho deciso di scriverne uno. ![](http://www.imhoproject.org/files/complice.gif)
Mi serviva un semplice client che
trasferisse un file predeterminato ogni giorno da mettere nel task scheduler.
Ho
trovato
un'ottima libreria open source che si chiama edtFTPNet molto facile da usare e con cui e' molto semplice
implementare il tutto:
using System;
using System.IO;
using EnterpriseDT.Net.Ftp;
namespace SimpleFTP
{
class Simple
{
[STAThread]
static void Main(string[] args)
{
try
{
FTPClient ftp = new FTPClient();
// Host
ftp.RemoteHost = "Host";
// Connect
ftp.Connect();
// Login
ftp.Login("User", "Password");
// Set up connect and transfer modes
ftp.ConnectMode = FTPConnectMode.ACTIVE;
ftp.TransferType = FTPTransferType.ASCII;
// Put file to remote server
ftp.Put("local_file", "remote_file");
// Close connection
ftp.Quit();
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
Console.ReadLine();
}
}
}
powered by IMHO 1.3