// Collection of code snippets by Arne Vajhøj // (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) using System; using System.IO; using System.Net; class Ftp2 { public static void Main(string[] args) { FtpWebRequest req = (FtpWebRequest)WebRequest.Create("ftp://192.168.1.10/utilities/utilities.zip"); FtpWebResponse resp = (FtpWebResponse)req.GetResponse(); Stream f1 = resp.GetResponseStream(); Stream f2 = new FileStream("utilities.zip", FileMode.CreateNew, FileAccess.Write); byte[] b = new byte[1000]; int n; while((n = f1.Read(b, 0, b.Length)) > 0) { f2.Write(b, 0, n); } f2.Close(); f1.Close(); resp.Close(); } }