Here are two examples of opening read streams to files on an FTP server.
One example uses the FtpWebRequest method.
One example uses the WebClient method.
Here is a method of testing those functions:
using System;
using System.Diagnostics;
using System.IO;
using System.Net;
namespace UseFtpStreamExample
{
using FtpReadStreams;
class Program
{
static void Main(string[] args)
{
string strError = "";
string strFtpUri =
#if !DEBUG
"ftp://ftp.myServer.com/SomeFile.txt";
#else
"ftp://download.textpad.com/welcome.msg";
#endif
// Be sure to open an debug output window to see file contents
if (!CFtpReadStream.DoWebRequestExample(strFtpUri, ref strError))
{
Trace.WriteLine("Could not read WR: " + strError);
return;
}
// Be sure to open an debug output window to see file contents
if (!CFtpReadStream.DoWebClientExample(strFtpUri, ref strError))
{
Trace.WriteLine("Could not read WC: " + strError);
return;
}
Trace.WriteLine("Finished");
}
}
}