ftp断点续传的问题
Uri uri = new Uri(baseUri, fullFilename);
request = (FtpWebRequest)WebRequest.Create(uri);
request.ContentOffset = _fileOffset; //设置开始下载文件的偏移量
request.Method = WebRequestMethods.Ftp.DownloadFile;
request.Credentials = new NetworkCredential(username,password);
response = (FtpWebResponse)request.GetResponse();
inStream = response.GetResponseStream();
// inStream.CanSeek;
outStream = File.OpenWrite(locDownAddress + @ "\ " + filename);
byte[] buffer = new byte[1024];
int size = 0;
while ((size = inStream.Read(buffer, 0, 1024)) > 0)
{
outStream.Write(buffer, 0, size);
}
以上是部分代码 现在想实现断点续传,( request.ContentOffset = _fileOffset; //设置开始下载文件的偏移量)这个值如何取得,我怎么才能准确取到文件下载了多少呢?如果这个值错误的话,下来的文件也用不了 :(
------解决方案--------------------up!