2017-03-13 6 views
-2

하나의 드라이브 서버에있는 큰 파일을 다운로드 중입니다.다운로드 속도가 Windows XP에서 상당히 느립니다. - httpwebrequest

일반적으로 Windows 7> 다운로드 속도는 최대 1500kb/s에 도달합니다.

Windows XP에서 다운로드는 최대 500kb/s에 도달합니다.

무엇이이 원인 일 수 있습니까?

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); 
      } 

     } 
    } 
+2

기계의 하드웨어가 동일합니까? – maccettura

+0

나는 두 개의 윈도우 XP PC에서 시도했는데 하나는 1Gb RAM을 가지고 350kb/s를 다운로드했고 2gb RAM은 450kb/s를 다운로드 받았다. 그러나 RAM의 결함인지는 확실하지 않다. – AlanRubinoff

답변

-1

Windows XP는 거의 15 세입니다. T1은 1.5mbps (187kB/s)에서 빠르다고 여겨져 내부 TCP 스택이 이러한 조건에 맞게 최적화 된 것으로 보입니다. 대기 시간 및 메모리 사용에 도움이되는 더 작은 버퍼. 더 현대적인 반복만큼 최적의 대역폭으로 처리 할 수 ​​없기를 기대합니다.

모두 당신의 8K 버퍼가 약간 작게 보입니다. iBufferSize을 262,144 바이트 크기로 늘리려고 시도 했습니까?

관련 문제