0

I'm working on an Asynchronous HTTP handler and trying to figure out if the HttpResponse.Write function blocks until it receives an ACK from the client.

The MSDN documentation doesn't specifically say; however, I do know that the MSDN documentation for the ISAPI WriteClient() function (a similar mechanism) mentions that the synchronous version does block while attempting to send data to the client.

I thought of three possible ways to determine the answer:

  1. Have someone tell me its non-blocking
  2. Write a low level TCP test client and set break point on the acknowledgement ( is this possible?)
  3. Use reflection to inspect the inner workings of the HTTPResponse.Write method ( is this possible?)
Aristos
  • 66,005
  • 16
  • 114
  • 150
camper
  • 26
  • 2

2 Answers2

2

Its not blocking, but can use a buffer and send them all together.

Try to set HttpResponse.Buffer=false; to direct write to your client.

You can also use the HttpResponse.Flush(); to force to send what you have to your client.

About HttpResponse.Buffer Property on MSDN

And maybe this intresting you: Web app blocked while processing another web app on sharing same session

Community
  • 1
  • 1
Aristos
  • 66,005
  • 16
  • 114
  • 150
0

HttpResponse operates in two distinct modes, buffered and unbuffered. In buffered mode, the various Write functions put their data into a memory region and the function returns as soon as the data is copied over. If you set Buffer to false, Write blocks until all of the data is sent to the client.

bmm6o
  • 6,187
  • 3
  • 28
  • 55