开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜