Click here to Skip to main content
15,888,351 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: Creating a Setup Pin
matthias s.13-Jul-04 2:17
matthias s.13-Jul-04 2:17 
GeneralRe: Creating a Setup Pin
shiraztk13-Jul-04 2:47
shiraztk13-Jul-04 2:47 
GeneralRe: Creating a Setup Pin
matthias s.13-Jul-04 3:20
matthias s.13-Jul-04 3:20 
GeneralFramework Install problems Pin
kratchkov3-Jul-04 3:50
kratchkov3-Jul-04 3:50 
GeneralRe: Framework Install problems Pin
Steven Campbell3-Jul-04 7:46
Steven Campbell3-Jul-04 7:46 
GeneralObfuscators? I hate them. Pin
Alberto Bencivenni3-Jul-04 1:27
Alberto Bencivenni3-Jul-04 1:27 
GeneralRe: Obfuscators? I hate them. Pin
Colin Angus Mackay3-Jul-04 1:34
Colin Angus Mackay3-Jul-04 1:34 
GeneralHttpWebResponseStream download speed Pin
Arn_e2-Jul-04 22:17
Arn_e2-Jul-04 22:17 
Hello!

I'm writting an app that downloads binary files via http from a server but I'm getting very slow download speeds. I'm getting around 10% - 50% of what I get with Internet Explorer's 'Save Target As' command.

Below is the code I'm using for the reading of the stream from HttpGetResponseStream(). The code is inside a download function which I call about 30 times in a row, the app is single threaded so everything is happening in the main thread. Sometimes the first download goes at the proper speed then all subsequent downloads get progressivily slower.

While my app is downloading a file if I use Internet Explorer's 'Save Target As' on the same file I get a much faster download speed, so I know the server isn't clogged. Somehow this code just doesn't download at max speed. I've tried WebClient.DownloadFile() and that is even slower than the code below.

Any help is *greatly* appreciated!

Thank you!

Arn


<br />
// Read the whole file into memory<br />
Stream  http_stream = http_response.GetResponseStream();<br />
int     data_size   = (int)http_response.ContentLength;<br />
byte[]  data_buffer = new byte[data_size];<br />
int     position    = 0;<br />
<br />
while( position < data_size )<br />
{<br />
    int bytes_to_read = data_size - position;<br />
    int bytes_read    = http_stream.Read(data_buffer, position, bytes_to_read);<br />
<br />
    if( bytes_read > 0 )<br />
    {<br />
        position += bytes_read;<br />
    }<br />
}<br />
<br />
http_stream.Close();<br />

GeneralShould I write an article... Pin
NormDroid2-Jul-04 0:06
professionalNormDroid2-Jul-04 0:06 
GeneralRe: Should I write an article... Pin
Ray Cassick2-Jul-04 17:22
Ray Cassick2-Jul-04 17:22 
GeneralConnecting to a local .NET DataSet Pin
kenanja1-Jul-04 1:45
kenanja1-Jul-04 1:45 
GeneralUpgarde Pin
Zamolxes1-Jul-04 1:18
Zamolxes1-Jul-04 1:18 
GeneralRe: Upgarde Pin
mav.northwind2-Jul-04 22:27
mav.northwind2-Jul-04 22:27 
GeneralAfterCollapse in Compact Framework Pin
ting66830-Jun-04 21:13
ting66830-Jun-04 21:13 
General.NET beta 1 date Pin
Serge Lobko-Lobanovsky30-Jun-04 4:23
Serge Lobko-Lobanovsky30-Jun-04 4:23 
GeneralRe: .NET beta 1 date Pin
bneacetp30-Jun-04 11:55
bneacetp30-Jun-04 11:55 
GeneralRe: .NET beta 1 date Pin
Serge Lobko-Lobanovsky30-Jun-04 22:49
Serge Lobko-Lobanovsky30-Jun-04 22:49 
GeneralRe: .NET beta 1 date Pin
bneacetp1-Jul-04 0:38
bneacetp1-Jul-04 0:38 
GeneralRe: .NET beta 1 date Pin
Colin Angus Mackay1-Jul-04 0:49
Colin Angus Mackay1-Jul-04 0:49 
GeneralSurvey... Pin
Orkun GEDiK29-Jun-04 8:46
Orkun GEDiK29-Jun-04 8:46 
GeneralRe: Survey... Pin
Colin Angus Mackay30-Jun-04 12:48
Colin Angus Mackay30-Jun-04 12:48 
Generaldotnet setup Pin
zainu28-Jun-04 23:38
zainu28-Jun-04 23:38 
GeneralRe: dotnet setup Pin
bneacetp30-Jun-04 12:05
bneacetp30-Jun-04 12:05 
GeneralRe: dotnet setup Pin
shiraztk30-Jun-04 18:39
shiraztk30-Jun-04 18:39 
GeneralRe: dotnet setup Pin
bneacetp30-Jun-04 23:51
bneacetp30-Jun-04 23:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.