Skip to content

Commit b79650a

Browse files
committed
fixes #10895
1 parent 2c0d1a4 commit b79650a

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

xml/System.Net.Sockets/NetworkStream.xml

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -422,13 +422,13 @@
422422
423423
## Remarks
424424
> [!IMPORTANT]
425-
> This is a compatibility API, we don't recommend to use the [APM](/dotnet/standard/asynchronous-programming-patterns/asynchronous-programming-model-apm) (Begin / End) methods for new development. Instead, use the Task-based equivalents.
425+
> This is a compatibility API. We don't recommend using the [APM](/dotnet/standard/asynchronous-programming-patterns/asynchronous-programming-model-apm) (Begin / End) methods for new development. Instead, use the Task-based equivalents.
426426
427427
You can pass a callback that implements <xref:System.AsyncCallback> to <xref:System.Net.Sockets.NetworkStream.BeginRead%2A> in order to get notified about the completion of the operation. Note that if the underlying network stack completes the operation synchronously, the callback will be executed inline, during the call to <xref:System.Net.Sockets.NetworkStream.BeginRead%2A>. In this case, the <xref:System.IAsyncResult.CompletedSynchronously%2A> property on the returned <xref:System.IAsyncResult> will be set to `true` to indicate that the method completed synchronously. Use the <xref:System.IAsyncResult.AsyncState%2A> property of the <xref:System.IAsyncResult> to obtain the state object passed to the <xref:System.Net.Sockets.NetworkStream.BeginRead%2A> method.
428428
429429
The <xref:System.Net.Sockets.NetworkStream.BeginRead%2A> operation must be completed by calling the <xref:System.Net.Sockets.NetworkStream.EndRead%2A> method. Typically, the method is invoked by the provided <xref:System.AsyncCallback> delegate. <xref:System.Net.Sockets.NetworkStream.EndRead%2A> will block the calling thread until the operation is completed.
430430
431-
The operation reads as much data as is available, up to the number of bytes specified by the `size` parameter.
431+
The operation reads as much data as is available, up to the number of bytes specified by the `count` parameter.
432432
433433
> [!NOTE]
434434
> If you receive an <xref:System.IO.IOException>, check the <xref:System.Exception.InnerException%2A> property to determine if it was caused by a <xref:System.Net.Sockets.SocketException>. If so, use the <xref:System.Net.Sockets.SocketException.ErrorCode%2A> property to obtain the specific error code.
@@ -540,7 +540,7 @@
540540
541541
## Remarks
542542
> [!IMPORTANT]
543-
> This is a compatibility API, we don't recommend to use the [APM](/dotnet/standard/asynchronous-programming-patterns/asynchronous-programming-model-apm) (Begin / End) methods for new development. Instead, use the Task-based equivalents.
543+
> This is a compatibility API. We don't recommend using the [APM](/dotnet/standard/asynchronous-programming-patterns/asynchronous-programming-model-apm) (Begin / End) methods for new development. Instead, use the Task-based equivalents.
544544
545545
You can pass a callback that implements <xref:System.AsyncCallback> to <xref:System.Net.Sockets.NetworkStream.BeginWrite%2A> in order to get notified about the completion of the operation. Note that if the underlying network stack completes the operation synchronously, the callback will be executed inline, during the call to <xref:System.Net.Sockets.NetworkStream.BeginWrite%2A>. In this case, the <xref:System.IAsyncResult.CompletedSynchronously%2A> property on the returned <xref:System.IAsyncResult> will be set to `true` to indicate that the method completed synchronously. Use the <xref:System.IAsyncResult.AsyncState%2A> property of the <xref:System.IAsyncResult> to obtain the state object passed to the <xref:System.Net.Sockets.NetworkStream.BeginWrite%2A> method.
546546
@@ -1113,12 +1113,10 @@ The Close method frees both unmanaged and managed resources associated with the
11131113
11141114
## Remarks
11151115
> [!IMPORTANT]
1116-
> This is a compatibility API, we don't recommend to use the [APM](/dotnet/standard/asynchronous-programming-patterns/asynchronous-programming-model-apm) (Begin / End) methods for new development. Instead, use the Task-based equivalents.
1116+
> This is a compatibility API. We don't recommend using the [APM](/dotnet/standard/asynchronous-programming-patterns/asynchronous-programming-model-apm) (Begin / End) methods for new development. Instead, use the Task-based equivalents.
11171117
11181118
The <xref:System.Net.Sockets.NetworkStream.EndRead%2A> method completes the read operation started by the <xref:System.Net.Sockets.NetworkStream.BeginRead%2A> method. You need to pass the <xref:System.IAsyncResult> created by the matching <xref:System.Net.Sockets.NetworkStream.BeginRead%2A> call. <xref:System.Net.Sockets.NetworkStream.EndRead%2A> will block the calling thread until the operation is completed.
11191119
1120-
The operation reads as much data as is available, up to the number of bytes specified by the `size` parameter.
1121-
11221120
> [!NOTE]
11231121
> If you receive an <xref:System.IO.IOException>, check the <xref:System.Exception.InnerException%2A> property to determine if it was caused by a <xref:System.Net.Sockets.SocketException>. If so, use the <xref:System.Net.Sockets.SocketException.ErrorCode%2A> property to obtain the specific error code.
11241122
@@ -1179,12 +1177,10 @@ The Close method frees both unmanaged and managed resources associated with the
11791177
11801178
## Remarks
11811179
> [!IMPORTANT]
1182-
> This is a compatibility API, we don't recommend to use the [APM](/dotnet/standard/asynchronous-programming-patterns/asynchronous-programming-model-apm) (Begin / End) methods for new development. Instead, use the Task-based equivalents.
1180+
> This is a compatibility API. We don't recommend using the [APM](/dotnet/standard/asynchronous-programming-patterns/asynchronous-programming-model-apm) (Begin / End) methods for new development. Instead, use the Task-based equivalents.
11831181
11841182
The <xref:System.Net.Sockets.NetworkStream.EndWrite%2A> method completes the read operation started by the <xref:System.Net.Sockets.NetworkStream.BeginWrite%2A> method. You need to pass the <xref:System.IAsyncResult> created by the matching <xref:System.Net.Sockets.NetworkStream.BeginWrite%2A> call. <xref:System.Net.Sockets.NetworkStream.EndWrite%2A> will block the calling thread until the operation is completed.
11851183
1186-
The operation reads as much data as is available, up to the number of bytes specified by the `size` parameter.
1187-
11881184
> [!NOTE]
11891185
> If you receive an <xref:System.IO.IOException>, check the <xref:System.Exception.InnerException%2A> property to determine if it was caused by a <xref:System.Net.Sockets.SocketException>. If so, use the <xref:System.Net.Sockets.SocketException.ErrorCode%2A> property to obtain the specific error code.
11901186
@@ -1552,15 +1548,14 @@ There is a failure reading from the network.</exception>
15521548
<format type="text/markdown"><![CDATA[
15531549
15541550
## Remarks
1555-
This method reads data into `buffer` and returns the number of bytes successfully read. The `Read` operation reads as much data as is available, up to the number of bytes specified by the `size` parameter.
1551+
This method reads data into `buffer` and returns the number of bytes successfully read. The `Read` operation reads as much data as is available, up to the number of bytes specified by the `count` parameter.
15561552
15571553
> [!NOTE]
15581554
> Check to see if the <xref:System.Net.Sockets.NetworkStream> is readable by calling the <xref:System.Net.Sockets.NetworkStream.CanRead> property. If you attempt to read from a <xref:System.Net.Sockets.NetworkStream> that is not readable, you will get an <xref:System.InvalidOperationException>.
15591555
15601556
> [!NOTE]
15611557
> If you receive an <xref:System.IO.IOException>, check the <xref:System.Exception.InnerException> property to determine if it was caused by a <xref:System.Net.Sockets.SocketException>. If so, use the <xref:System.Net.Sockets.SocketException.ErrorCode> property to obtain the specific error code and refer to the [Windows Sockets version 2 API error code](/windows/desktop/winsock/windows-sockets-error-codes-2) documentation for a detailed description of the error.
15621558
1563-
15641559
## Examples
15651560
The following code example reads data from the <xref:System.Net.Sockets.NetworkStream> into a buffer. If data is available, it continues reading until the end of the stream is reached, appending the received data to a <xref:System.Text.StringBuilder>.
15661561
:::code language="csharp" source="~/snippets/csharp/System.Net.Sockets/NetworkStream/Overview/source.cs" id="Snippet4":::
@@ -1776,7 +1771,7 @@ There is a failure reading from the network.</exception>
17761771
<format type="text/markdown"><![CDATA[
17771772
17781773
## Remarks
1779-
This method reads data into `buffer` and returns the number of bytes successfully read. The `ReadAsync` operation reads as much data as is available, up to the number of bytes specified by the `size` parameter.
1774+
This method reads data into `buffer` and returns the number of bytes successfully read. The `ReadAsync` operation reads as much data as is available, up to the number of bytes specified by the `count` parameter.
17801775
17811776
> [!NOTE]
17821777
> Check to see if the <xref:System.Net.Sockets.NetworkStream> is readable by calling the <xref:System.Net.Sockets.NetworkStream.CanRead> property. If you attempt to read from a <xref:System.Net.Sockets.NetworkStream> that is not readable, you will get an <xref:System.InvalidOperationException>.
@@ -2218,7 +2213,7 @@ There was a failure while writing to the network.</exception>
22182213
<format type="text/markdown"><![CDATA[
22192214
22202215
## Remarks
2221-
This method starts at the specified `offset` and sends `size` bytes from the contents of `buffer` to the network. The `Write` method blocks until the requested number of bytes is sent or a <xref:System.Net.Sockets.SocketException> is thrown.
2216+
This method starts at the specified `offset` and sends `count` bytes from the contents of `buffer` to the network. The `Write` method blocks until the requested number of bytes is sent or a <xref:System.Net.Sockets.SocketException> is thrown.
22222217
22232218
> [!NOTE]
22242219
> Check to see if the <xref:System.Net.Sockets.NetworkStream> is writable by calling the <xref:System.Net.Sockets.NetworkStream.CanWrite> property. If you attempt to write to a <xref:System.Net.Sockets.NetworkStream> that is not writable, you will get an <xref:System.InvalidOperationException>.
@@ -2438,7 +2433,7 @@ There was a failure while writing to the network.</exception>
24382433
<remarks>
24392434
<format type="text/markdown"><![CDATA[
24402435
## Remarks
2441-
This method starts at the specified `offset` and sends `size` bytes from the contents of `buffer` to the network.
2436+
This method starts at the specified `offset` and sends `count` bytes from the contents of `buffer` to the network.
24422437
24432438
> [!NOTE]
24442439
> Check to see if the <xref:System.Net.Sockets.NetworkStream> is writable by calling the <xref:System.Net.Sockets.NetworkStream.CanWrite> property. If you attempt to write to a <xref:System.Net.Sockets.NetworkStream> that is not writable, you will get an <xref:System.InvalidOperationException>.

0 commit comments

Comments
 (0)