Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending a binary stream to the clients browser

Tags:

asp-classic

I was wondering if there is any difference in performance (or any other important factor) between a file sent to the browser from our server by this method :

For i = 1 To fileSize \ chunk
  If Not Response.IsClientConnected Then Exit For
  Response.BinaryWrite stream.Read(chunk)
  Response.Flush
Next

VS

the old plain file access method that the IIS comes with.

We are working on a file manager handler for security reasons and would like to know what is the performance hit.

like image 902
AMember Avatar asked Dec 31 '25 22:12

AMember


1 Answers

Unless you are dealing with a fairly large file, there shouldn't be a noticeable difference. Since you are creating the chunks manually and the flushing the buffer, you are going to have more packet traffic to the client (the payload of the packet or the last packet will be only partially full). However, as I said, this probably won't be noticeable unless you have a large file and even then it's not likely to show up.

like image 117
Tarwn Avatar answered Jan 06 '26 18:01

Tarwn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!