Skip to content

Commit f2cc991

Browse files
authored
Document when async HttpListener send completes (#8470)
* Document when async HttpListener send completes Fixes #2068 * Code review feedback
1 parent ed32a71 commit f2cc991

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

xml/System.Net/HttpListener.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,8 +1246,8 @@ The following code example demonstrates calling the `Close` method:
12461246
If this instance is already stopped, calling this method has no effect.
12471247
12481248
After you have stopped an <xref:System.Net.HttpListener> object, you can use the <xref:System.Net.HttpListener.Start%2A> method to restart it.
1249-
1250-
1249+
1250+
This method does not block to finish sending responses for currently accepted connections.
12511251
12521252
## Examples
12531253

xml/System.Net/HttpListenerResponse.xml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -430,9 +430,12 @@
430430
## Remarks
431431
If you are sending body data with the response, you can use this method to send it as a <xref:System.Byte> array instead of writing the body data to the <xref:System.Net.HttpListenerResponse.OutputStream%2A> property and calling the <xref:System.Net.HttpListenerResponse.Close%2A> method.
432432
433-
This method closes the response stream and the <xref:System.Net.HttpListenerRequest> associated with the response.
434-
435-
433+
This method closes the response stream and the <xref:System.Net.HttpListenerRequest> associated with the response.
434+
435+
If `false` is specified as the `willBlock`, the method returns immediately and the connection is closed asynchronously once the data is sent.
436+
437+
> [!NOTE]
438+
> If closing asynchronously, it is not possible for the caller to determine when the data have been sent. In addition to that, disposing the <xref:System.Net.HttpListenerResponse>, <xref:System.Net.HttpListenerContext> or <xref:System.Net.HttpListener> may close the connection before all the data are sent.
436439
437440
## Examples
438441
The following code example demonstrates calling this method.

0 commit comments

Comments
 (0)