开发者

Is there a way to change the Transmission size when ftp'ing in .NET 2.0?

开发者 https://www.devze.com 2022-12-31 16:53 出处:网络
My ftp is truncating data. Using a different product we are able to change the tranmissions size and it works. But I can\'t figure out hwo to do it in .NET.

My ftp is truncating data. Using a different product we are able to change the tranmissions size and it works. But I can't figure out hwo to do it in .NET.

                // FTP the file
            FtpWeb开发者_如何转开发Request ftp = (FtpWebRequest)FtpWebRequest.Create(ftpfullpath);
            ftp.Credentials = new NetworkCredential(user, pwd);

            ftp.KeepAlive = true;
            ftp.UseBinary = false;  //Use ascii.

            ftp.Method = WebRequestMethods.Ftp.UploadFile;

            FileStream fs = File.OpenRead(inputfilepath + ftpfileName);
            byte[] buffer = new byte[fs.Length];
            fs.Read(buffer, 0, buffer.Length);
            fs.Close();

            Stream ftpstream = ftp.GetRequestStream();
            ftpstream.Write(buffer, 0, buffer.Length);
            ftpstream.Close();  


Just a thought...Before closing your streams, try to Flush them to see if it helps. I'm not sure if changing your transmission size will really do anything.

0

精彩评论

暂无评论...
验证码 换一张
取 消