0

I am sending and receiving a file to an OCR service via FTP. using the FtpWebRequest library in .NET

I used the same block of code for setting up the connection in both cases with only two changes:

FtpWebRequest ftp = (FtpWebRequest)FtpWebRequest.Create("ftp://" + server + "/FTP/Input/" + fileNameWithoutExtension+".pdf");
                            ftp.Method = WebRequestMethods.Ftp.UploadFile;
                            ftp.Credentials = new NetworkCredential(username, password);
                            ftp.Timeout = 10000;
                            ftp.UseBinary = true;
                            ftp.KeepAlive = false;
                            ftp.UsePassive = true;

                            try
                            {
                                using (var ftpStream = ftp.GetRequestStream())

vs.

FtpWebRequest ftp = (FtpWebRequest)FtpWebRequest.Create("ftp://" + server + "/FTP/Output/" + fileNameWithoutExtension+".txt");
                            ftp.Method = WebRequestMethods.Ftp.DownloadFile;
                            ftp.Credentials = new NetworkCredential(username, password);
                            ftp.Timeout = 10000000;
                            ftp.UseBinary = true;
                            ftp.KeepAlive = false;
                            ftp.UsePassive = true;

                            try
                            {
                                using (var ftpStream = ftp.GetRequestStream())

Opening up the "ftp" object, the "method" for "upload" is "STOR" the "method" for "download" is "RETR"

The STOR works the RETR just times out

I can manually connect to the directory and list as well as download the files using the Windows Explorer

but if I connect via the "ftp" client in CMD - I also get timeouts even using GET

any ideas?

0 Answers0