Consider an ASP.NET page with this code:
while (read)
{
Response.OutputStream.Write(buffer, 0, buffer.Length);
Response.Flush();
}
The application should be highly performance-tuned and handle thousands on concurrent requests and the main purpose is transferring huge binary file to clients over high speed connections. I can do the job with an ASP.NET page
, with HTTP Handler
, IHttpAsyncHandler
, ISAPI filter
and ...
The question is what is the best choice for this purpose ?
If the page is liable to be I/O bound then I'd go the Async road. But you should use the asynchronous read methods (if available) on your Stream
object as well.
For more information see:
FileStream Constructor - with async example
To address your comment that you receive this data via a socket, you'll also find that most of the System.Net.Sockets
namespace classes support asynchronous behaviour.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With