0
Reply

Problem with closing network stream from client

Ask a question
itay shwartz

itay shwartz

17y
1.9k
1

Hey,

 

I’m having the weirdest problem, trying to close a stream that passes information between a client and HTTP server that I have built.

 

The server is writing a file to HttpListenerContext.Response.OutputStream.

 

During this writing, I want to close the stream from the client (canceling feature).

 

When I try from my client to enforce the server to close the stream (I’m holding in my client System.Net.ConnectionStream) by writing stream.close(), it is waiting and only when the server is closing the response, it closes the stream.

 

Any ideas how I can force it to close from the client?

 

Thanks!