Skip to content

Commit 04b0287

Browse files
authored
Update comment on return value of NetworkStream.Read* variants
Fixes #10925. Mentions that returns 0 when socket was closed.
1 parent ae0bb95 commit 04b0287

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

xml/System.Net.Sockets/NetworkStream.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,7 @@ The Close method frees both unmanaged and managed resources associated with the
11071107
<Docs>
11081108
<param name="asyncResult">An <see cref="T:System.IAsyncResult" /> that represents an asynchronous call.</param>
11091109
<summary>Handles the end of an asynchronous read.</summary>
1110-
<returns>The number of bytes read from the <see cref="T:System.Net.Sockets.NetworkStream" />.</returns>
1110+
<returns>The number of bytes read from the <see cref="T:System.Net.Sockets.NetworkStream" />, or 0 if the underlying socket was closed.</returns>
11111111
<remarks>
11121112
<format type="text/markdown"><![CDATA[
11131113
@@ -1466,7 +1466,7 @@ The Close method frees both unmanaged and managed resources associated with the
14661466
<Docs>
14671467
<param name="buffer">A region of memory to store data read from the <see cref="T:System.Net.Sockets.NetworkStream" />.</param>
14681468
<summary>Reads data from the <see cref="T:System.Net.Sockets.NetworkStream" /> and stores it to a span of bytes in memory.</summary>
1469-
<returns>The number of bytes read from the <see cref="T:System.Net.Sockets.NetworkStream" />.</returns>
1469+
<returns>The number of bytes read from the <see cref="T:System.Net.Sockets.NetworkStream" />, or 0 if the underlying socket was closed.</returns>
14701470
<remarks>
14711471
<format type="text/markdown"><![CDATA[
14721472
@@ -1543,7 +1543,7 @@ There is a failure reading from the network.</exception>
15431543
<param name="size">The number of bytes to read from the <see cref="T:System.Net.Sockets.NetworkStream" />.</param>
15441544
<param name="count">The number of bytes to read from the <see cref="T:System.Net.Sockets.NetworkStream" />.</param>
15451545
<summary>Reads data from the <see cref="T:System.Net.Sockets.NetworkStream" /> and stores it to a byte array.</summary>
1546-
<returns>The number of bytes read from the <see cref="T:System.Net.Sockets.NetworkStream" />.</returns>
1546+
<returns>The number of bytes read from the <see cref="T:System.Net.Sockets.NetworkStream" />, or 0 if the underlying socket was closed.</returns>
15471547
<remarks>
15481548
<format type="text/markdown"><![CDATA[
15491549
@@ -1695,7 +1695,7 @@ There is a failure reading from the network.</exception>
16951695
<param name="buffer">The buffer to write the data to.</param>
16961696
<param name="cancellationToken">The token to monitor for cancellation requests.</param>
16971697
<summary>Reads data from the <see cref="T:System.Net.Sockets.NetworkStream" /> and stores it in a byte memory range as an asynchronous operation.</summary>
1698-
<returns>A <see cref="T:System.Threading.Tasks.ValueTask`1" /> that represents the asynchronous read operation. The value of its <see cref="P:System.Threading.Tasks.ValueTask`1.Result" /> property contains the total number of bytes read into <paramref name="buffer" />.</returns>
1698+
<returns>A <see cref="T:System.Threading.Tasks.ValueTask`1" /> that represents the asynchronous read operation. The value of its <see cref="P:System.Threading.Tasks.ValueTask`1.Result" /> property contains the total number of bytes read into <paramref name="buffer" />, or 0 if the underlying socket was closed.</returns>
16991699
<remarks>
17001700
<format type="text/markdown"><![CDATA[
17011701
@@ -1766,7 +1766,7 @@ There is a failure reading from the network.</exception>
17661766
<param name="count">The number of bytes to read from the <see cref="T:System.Net.Sockets.NetworkStream" />.</param>
17671767
<param name="cancellationToken">The token to monitor for cancellation requests.</param>
17681768
<summary>Reads data from the <see cref="T:System.Net.Sockets.NetworkStream" /> and stores it to a specified range of a byte array as an asynchronous operation.</summary>
1769-
<returns>A task that represents the asynchronous read operation. The value of its <see cref="P:System.Threading.Tasks.Task`1.Result" /> property contains the total number of bytes read into <paramref name="buffer" />.</returns>
1769+
<returns>A task that represents the asynchronous read operation. The value of its <see cref="P:System.Threading.Tasks.Task`1.Result" /> property contains the total number of bytes read into <paramref name="buffer" />, or 0 if the underlying socket was closed.</returns>
17701770
<remarks>
17711771
<format type="text/markdown"><![CDATA[
17721772

0 commit comments

Comments
 (0)