Entries on this site reference things being written to “the stream”. (I was reading this one about MVC in particular – ASP.NET MVC – Why don't HtmlHelpers render directly to the stream?)
It talks about returning an MvcHtmlString instance vs. writing to the stream. I am having trouble understanding what “the stream” is. And what writing to it would “look like” vs returning MvcHtmlString.
I imagine “the stream” is not just an ASP.NET MVC term?
If anybody has a visual representation of this, I think that would help most of all! (if not that’s OK too)
Thanks so much!
“The Stream” is shorthand for “The HTTP Response Stream”, the place where the response bytes are written to send them to the user.
To communicate between any two systems information is sent between them. The information itself is just a series of bytes written to a socket at the sender-side and read from a corresponding socket at the receiver-side. This is the fundamental abstraction of all client-server communication over TCP.
In HTTP, there is a request stream, containing the bytes of the request, written by the client and read by the server, and there is a response stream, containing the bytes of the response, written by the server and read by the client.