"The connection with the server was reset" error during large download

H

hoenes1

Hi all,

I'm trying to send files to a client following the instructions of

http://support.microsoft.com/?id=812406

Everything works fine, but if files are large and/or if the bandwidth
is small, after a certain time, the error "The connection with the
server was reset" occurs. I think the time span when this error occurs
relates closely to the IIS HTTP Connection timeout setting which is by
default set to 120 seconds (changing the value to 30 seconds results
in the error occuring much earlier). Is my only chance to increase
this value to about 10.000 to enable a user to download a large file
with small bandwidth or am I barking up the wrong tree? Maybe it is
possible to renew the http connection in every pass of the while-loop?
Here's a code sample which sends the file:

long bufSize = 65536;
while (offset < size && Response.IsClientConnected)
{
if (size-offset < bufSize)
{
bufSize = size-offset;
buf = new byte[bufSize];
}
fs.Read(buf, 0, (int)bufSize);
if (Response.IsClientConnected)
{
Response.OutputStream.Write(buf, 0, (int)bufSize);
Response.Flush();
}
else
break;
offset += bufSize;
}

Please post if you know something about this issue, I'm sure many
others will benefit from a solution since downloading large files is a
very common task.
Thanks in advance.
 
Joined
Sep 23, 2008
Messages
1
Reaction score
0
"connection with the server was reset" error

I am plagued by this error with large downloads and I dont know where to start looking for the culprit. I dont know enough about computers If anybody could email me the steps to eradicate this one it would be most appreciated

Des
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top