Last post Nov 28, 2008 08:29 PM by andrewdb
Nov 24, 2008 01:37 AM|andrewdb|LINK
I was hoping to use the HttpListener class to stream (i.e., send the response as it is generated rather than buffering on the server before sending) a response to the client. Also, I don't know the length of the response until it has been generated.
The documentation for HttpListenerResponse.ContentLength64 contains the rather enigmatic sentence: "When using a format that is not send the data chunked or raw, you must set the
ContentLength64 property. If you do not, the
HttpListener does not send the response data."
This suggests that if I could set the "format" to "raw", I could send the data without knowing the length in advance. However, I don't know what they are referring to by either "format" or "raw".
Any advice would be much appreciated,
Nov 27, 2008 10:26 PM|Nai-Dong Jin - MSFT|LINK
Actually, inHTTP 1.1 the client and server can send chunked data. This is done so you don’t need to send the Content-Length.
And for raw data, you also don’t need to send the Content-Length.
I suggest that you can try the following article which may be helpful to you.
Nov 28, 2008 08:29 PM|andrewdb|LINK
Thanks. My question was specifically about the HttpListener class in .NET. I have found that it always seems to buffer the response. The documentation does mention sending "raw" data, but it doesn't say how to indicate that raw data is to be sent.