Is it possible to use http2 features with HTTPListeners yet? I didn't hear anything about it but i heard that the new releases of the IIS / asp.net stack support it so i was hoping HTTPListener would be ugpraded too or an alternative would be provided.
If not what would be the best option to support http2, working with raw sockets or is it possible at all to extend httplistener?
Edit : to clarify i'm not just looking for a solution that "reports" http2 but one that enables me to actually use http2 new features such as pushing content, my use case is i have a custom CMS (self written) server that is extremely low latency (replies near instantly to all requests) and the only thing left to optimise is being able to push content AND being able to multiplex as currently the only speedup i can hope for is avoiding the latency from so many rountrips
Using the HttpListener class, you can create a simple HTTP protocol listener that responds to HTTP requests.
An HTTP listener, also known as a network listener, is a listen socket that has an Internet Protocol (IP) address, a port number, a server name, and a default virtual server. Each virtual server provides connections between the server and clients through one or more listeners.
The Hypertext Transfer Protocol (HTTP) is an application protocol for distributed, collaborative, hypermedia information systems. HTTP is the foundation of data communication for the World Wide Web. HttpListener is a simple, programmatically controlled HTTP protocol listener. It can be used to create HTTP servers.
HttpListener is a managed "client" for the Windows kernel module http.sys (similar to how IIS is also a client for it). This version of this module which handles HTTP/2 appears to be only available in Win10 / IE. If you are running on Win10 and an HTTP/2 connection is made, it will likely look the same to HttpListener
, since the interface to http.sys
driver abstracts the protocol for clients of HttpListener
. If anything is different, it would be the HttpListenerResponse.ProtocolVersion
showing HTTP/2.
Looking at the source of HttpListener
, it seems like the interface to http.sys
is blob-oriented, just subscribing to requests and getting the request data in one big blob. This blob forms the basis of the managed HttpListenerContext
class, which has the request and response data exposed as properties. The HttpListenerResponse
sends the response via http.sys
by breaking the data into headers and data chunks which it exposes via the OutputStream
property. If multi-streams would be supported, this public API would need to change. It is certainly not currently supported, and my guess is that they won't change this API, and if HTTP/2 will be supported by HttpListener
either it will completely abstract HTTP/2 or provide some kind of WriteAsync
method to multiplex at this higher level. It sounds like you want to write directly against http.sys
to take advantage of lower level features of the protocol.
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