Ich lade große Datei auf einem Laufwerk Server.Download-Geschwindigkeit ist deutlich langsamer auf Windows XP - httpwebrequest
normalerweise auf Windows 7> die Download-Geschwindigkeit erreicht 1500kb/s max.
Auf Windows XP erreicht der Download 500kb/s max.
Was könnte möglicherweise die Ursache dafür sein?
private void DownloadFileRange(string sSourceURL, string sDestinationPath)
{
long iFileSize = 0;
int iBufferSize = 8192;
long tamanioArchivoExistente = 0;
System.IO.FileStream saveFileStream;
System.Net.HttpWebRequest hwRq;
System.Net.HttpWebResponse hwRes;
try
{
if (System.IO.File.Exists(sDestinationPath))
{
System.IO.FileInfo fINfo = new System.IO.FileInfo(sDestinationPath);
tamanioArchivoExistente = fINfo.Length;
}
if (tamanioArchivoExistente > 0)
saveFileStream = new System.IO.FileStream(sDestinationPath, System.IO.FileMode.Append, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite);
else
saveFileStream = new System.IO.FileStream(sDestinationPath, System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite);
hwRq = (HttpWebRequest)HttpWebRequest.Create(sSourceURL);
hwRq.Proxy = null;
//Esto funciona con NET 3.5
if (tamanioArchivoExistente > 0)
{
hwRq.AddRange(tamanioArchivoExistente);
}
hwRes = (HttpWebResponse)hwRq.GetResponse();
iFileSize = hwRes.ContentLength + tamanioArchivoExistente;
System.IO.Stream smRespStream;
smRespStream = hwRes.GetResponseStream();
if (tamanioArchivoExistente > 0)
{
bytesDescargados = tamanioArchivoExistente;
}
int iByteSize;
byte[] downBuffer = new byte[iBufferSize];
while ((iByteSize = smRespStream.Read(downBuffer, 0, downBuffer.Length)) > 0)
{
saveFileStream.Write(downBuffer, 0, iByteSize);
}
}
}
Haben die Maschinen die gleiche Hardware? – maccettura
Ich probierte in zwei Windows-XP-PCs, einer hatte 1 GB RAM und heruntergeladen 350 KB/s und der mit 2 GB RAM heruntergeladen 450 KB/s, aber ich bin mir nicht sicher, ob es der RAM ist schuld – AlanRubinoff