I am attempting to get a 57MB zipped file from our vendors FTP site using the following *.cs file code:
-----------------------------------------------------------------------------------------------------------
namespace EDI_FTP.MuzeCON
{
class FTPGetFile
{
static void Main(string[] args)
{
string[] files;
string server = "<ftp site listed here>";
string userName = "<username listed here>";
string password = "<password listed here>";
string path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
string pathSub = @"C:\EDIFTP\Muze\01ftp";
string fileName = "";
string newFileName="";
string SrcDir = "";
EnterpriseDT.Net.Ftp.FTPConnection ftpConnection1 = new FTPConnection();
ftpConnection1.ConnectMode = EnterpriseDT.Net.Ftp.FTPConnectMode.ACTIVE;
ftpConnection1.EventsEnabled = true;
ftpConnection1.ParsingCulture = new System.Globalization.CultureInfo("");
ftpConnection1.ServerPort = 21;
ftpConnection1.StrictReturnCodes = true;
ftpConnection1.Timeout = 300;
ftpConnection1.TransferNotifyInterval = ((long)(4096));
ftpConnection1.TransferType = EnterpriseDT.Net.Ftp.FTPTransferType.BINARY;
Logger.AddAppender(new FileAppender("c:\\FTPLOG\\log.txt"));
Logger.CurrentLevel = Level.ALL;
Logger log = Logger.GetLogger(typeof(FTPGetFile));
ftpConnection1.ServerAddress =server ;
ftpConnection1.UserName = userName;
ftpConnection1.Password = password;
SrcDir = "\\\\" + server + "\\" + "\\videoupd\\"+ fileName;
try
{
// Connect, get files and close
ftpConnection1.Connect();
ftpConnection1.ChangeWorkingDirectoryUp();
ftpConnection1.ChangeWorkingDirectory("/videoupd/");
files = ftpConnection1.GetFiles();
bool filefound=false;
foreach(string s in files)
{
FilesImported+=1;
if(s.StartsWith("fvas"))
{
filefound=true;
fileName = s;
ftpConnection1.DownloadFile(pathSub+"\\"+fileName, fileName);
-------------------------------------------------
As soon as it gets to the line ftpConnection1.DownloadFile(pathSub+"\\"+fileName, fileName); it errors out as shown below:
-------------------------------------------------
DEBUG [EnterpriseDT.Net.Ftp.FTPClient] 5 Sep 2006 08:38:12.737 : Connecting to 64.192.133.17:21
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 5 Sep 2006 08:38:12.940 : 220 muzeweb01 Microsoft FTP Service (Version 5.0).
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 5 Sep 2006 08:38:12.940 : ---> USER huppins
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 5 Sep 2006 08:38:13.033 : 331 Password required for huppins.
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 5 Sep 2006 08:38:13.033 : ---> PASS ********
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 5 Sep 2006 08:38:13.127 : 230-Welcome to Muze.com, your source of entertainment information. If you have any
questions about this site or need assistance in obtaining your data, please email
Accountmanagers@muze.com
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 5 Sep 2006 08:38:13.361 : 230 User huppins logged in.
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 5 Sep 2006 08:38:13.361 : ---> TYPE I
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 5 Sep 2006 08:38:13.455 : 200 Type set to I.
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 5 Sep 2006 08:38:14.189 : ---> CDUP
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 5 Sep 2006 08:38:14.283 : 250 CWD command successful.
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 5 Sep 2006 08:38:15.626 : ---> CWD /videoupd/
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 5 Sep 2006 08:38:15.720 : 250 CWD command successful.
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 5 Sep 2006 08:38:17.345 : ---> PORT 192,168,10,179,13,215
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 5 Sep 2006 08:38:17.438 : 200 PORT command successful.
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 5 Sep 2006 08:38:17.438 : ---> NLST .
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 5 Sep 2006 08:38:17.532 : 150 Opening BINARY mode data connection for file list.
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 5 Sep 2006 08:38:17.735 : 226 Transfer complete.
DEBUG [EnterpriseDT.Net.Ftp.FTPClient] 5 Sep 2006 08:38:17.735 : Found 13 listing lines
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 5 Sep 2006 08:39:16.579 : ---> PORT 192,168,10,179,13,216
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 5 Sep 2006 08:39:16.688 : 200 PORT command successful.
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 5 Sep 2006 08:39:16.688 : ---> RETR fvascii.zip
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 5 Sep 2006 08:39:16.782 : 150 Opening BINARY mode data connection for fvascii.zip(57966979 bytes).
ERROR [EnterpriseDT.Net.Ftp.FTPClient] 5 Sep 2006 08:40:23.705 : Caught exception : Unable to read data from the transport connection.
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.IO.BinaryReader.Read(Byte[] buffer, Int32 index, Int32 count)
at EnterpriseDT.Net.Ftp.FTPClient.ReadChunk(BinaryReader input, Byte[] chunk, Int32 chunksize)
at EnterpriseDT.Net.Ftp.FTPClient.GetBinary(String localPath, String remoteFile)
DEBUG [EDI_FTP.MuzeCON.FTPGetFile] 5 Sep 2006 08:40:46.622 : Unable to read data from the transport connection. : Unable to read data from the transport
connection.
at EnterpriseDT.Net.Ftp.FTPClient.GetBinary(String localPath, String remoteFile)
at EnterpriseDT.Net.Ftp.FTPClient.Get(String localPath, String remoteFile)
at EnterpriseDT.Net.Ftp.FTPConnection.DownloadFile(String localPath, String remoteFile)
at EDI_FTP.MuzeCON.FTPGetFile.Main(String[] args) in c:\source\edi_ftp_muzecon\ftp.cs:line 119