How to flush HttpListener response stream?

前端 未结 2 751
野趣味
野趣味 2020-12-28 23:48

HttpListener gives you response stream, but calling flush means nothing (and from sources it\'s clear, because it\'s actually doing nothing). Digging inside HTTP API shows t

2条回答
  •  萌比男神i
    2020-12-29 00:09

    I've not tried this yet, but how about writing a separate TCP server for streaming responses? Then forward the request from the HttpListener to the "internal" tcp server. Using this redirect you might be able to stream data back as you need.

    As for flushing it, they only way I see to do it is to simulate a dispose, without actually disposing. If you can hack into the HttpResponseStream object, tell it to dispose, unset the m_Closed flag, etc, you might be able to flush the streaming data.

提交回复
热议问题