Skip to content

Commit 95b8db5

Browse files
authored
Document missing Socket APIs (dotnet#7153)
* add missing summaries * SendPacketsElement remarks * add TcpListener remarks * fix Buffer remarks
1 parent 7094a4c commit 95b8db5

File tree

2 files changed

+67
-19
lines changed

2 files changed

+67
-19
lines changed

xml/System.Net.Sockets/SendPacketsElement.xml

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,16 @@
163163
<Parameter Name="buffer" Type="System.ReadOnlyMemory&lt;System.Byte&gt;" Index="0" FrameworkAlternate="net-6.0" />
164164
</Parameters>
165165
<Docs>
166-
<param name="buffer">To be added.</param>
167-
<summary>To be added.</summary>
168-
<remarks>To be added.</remarks>
166+
<param name="buffer">A <see cref="T:System.ReadOnlyMemory`1" /> of bytes to send using the <see cref="M:System.Net.Sockets.Socket.SendPacketsAsync(System.Net.Sockets.SocketAsyncEventArgs)" /> method.</param>
167+
<summary>Initializes a new instance of the <see cref="T:System.Net.Sockets.SendPacketsElement" /> class using the specified buffer.</summary>
168+
<remarks>
169+
<format type="text/markdown"><![CDATA[
170+
171+
## Remarks
172+
The <xref:System.Net.Sockets.SendPacketsElement> class is used with the <xref:System.Net.Sockets.SocketAsyncEventArgs.SendPacketsElements%2A?displayProperty=nameWithType> property to get or set a data buffer or file to be sent using the <xref:System.Net.Sockets.Socket.SendPacketsAsync%2A?displayProperty=nameWithType> method.
173+
174+
]]></format>
175+
</remarks>
169176
</Docs>
170177
</Member>
171178
<Member MemberName=".ctor">
@@ -244,10 +251,17 @@
244251
<Parameter Name="endOfPacket" Type="System.Boolean" Index="1" FrameworkAlternate="net-6.0" />
245252
</Parameters>
246253
<Docs>
247-
<param name="buffer">To be added.</param>
248-
<param name="endOfPacket">To be added.</param>
249-
<summary>To be added.</summary>
250-
<remarks>To be added.</remarks>
254+
<param name="buffer">A <see cref="T:System.ReadOnlyMemory`1" /> of bytes to send using the <see cref="M:System.Net.Sockets.Socket.SendPacketsAsync(System.Net.Sockets.SocketAsyncEventArgs)" /> method.</param>
255+
<param name="endOfPacket">Specifies that this element should not be combined with the next element in a single send request from the sockets layer to the transport. This flag is used for granular control of the content of each message on a datagram or message-oriented socket.</param>
256+
<summary>Initializes a new instance of the <see cref="T:System.Net.Sockets.SendPacketsElement" /> class using the specified buffer with an option to combine this element with the next element in a single send request from the sockets layer to the transport.</summary>
257+
<remarks>
258+
<format type="text/markdown"><![CDATA[
259+
260+
## Remarks
261+
The <xref:System.Net.Sockets.SendPacketsElement> class is used with the <xref:System.Net.Sockets.SocketAsyncEventArgs.SendPacketsElements%2A?displayProperty=nameWithType> property to get or set a data buffer or file to be sent using the <xref:System.Net.Sockets.Socket.SendPacketsAsync%2A?displayProperty=nameWithType> method.
262+
263+
]]></format>
264+
</remarks>
251265
</Docs>
252266
</Member>
253267
<Member MemberName=".ctor">
@@ -717,7 +731,9 @@
717731
<format type="text/markdown"><![CDATA[
718732
719733
## Remarks
720-
The default value for the <xref:System.Net.Sockets.SendPacketsElement.Buffer> property is `null` if the <xref:System.Net.Sockets.SendPacketsElement> object was not initialized with a `buffer` parameter.
734+
The default value for the <xref:System.Net.Sockets.SendPacketsElement.Buffer> property is `null` if the <xref:System.Net.Sockets.SendPacketsElement> object was not initialized with a `buffer` parameter or `buffer` was passed as a <xref:System.ReadOnlyMemory`1> of bytes.
735+
736+
In the latter case, the buffer can be obtained using the <xref:System.Net.Sockets.SendPacketsElement.MemoryBuffer> property.
721737
722738
]]></format>
723739
</remarks>
@@ -927,9 +943,17 @@
927943
<ReturnType>System.Nullable&lt;System.ReadOnlyMemory&lt;System.Byte&gt;&gt;</ReturnType>
928944
</ReturnValue>
929945
<Docs>
930-
<summary>To be added.</summary>
931-
<value>To be added.</value>
932-
<remarks>To be added.</remarks>
946+
<summary>Gets the buffer to be sent if the <see cref="T:System.Net.Sockets.SendPacketsElement" /> object was initialized with a <code>buffer</code> parameter.</summary>
947+
<value>The <see cref="T:System.ReadOnlyMemory`1" /> of bytes to be sent if the <see cref="T:System.Net.Sockets.SendPacketsElement" /> object was initialized with a <code>buffer</code> parameter.</value>
948+
<remarks>
949+
<format type="text/markdown"><![CDATA[
950+
951+
## Remarks
952+
The default value for the <xref:System.Net.Sockets.SendPacketsElement.MemoryBuffer> property is `null` if the <xref:System.Net.Sockets.SendPacketsElement> object was not initialized with a `buffer` parameter.
953+
If `buffer` was passed as a `byte[]`, <xref:System.Net.Sockets.SendPacketsElement.MemoryBuffer> returns the contents of <xref:System.Net.Sockets.SendPacketsElement.Buffer> as a <xref:System.ReadOnlyMemory`1> of bytes.
954+
955+
]]></format>
956+
</remarks>
933957
</Docs>
934958
</Member>
935959
<Member MemberName="Offset">

xml/System.Net.Sockets/TcpListener.xml

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -423,10 +423,22 @@
423423
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" Index="0" FrameworkAlternate="net-6.0" />
424424
</Parameters>
425425
<Docs>
426-
<param name="cancellationToken">To be added.</param>
427-
<summary>To be added.</summary>
428-
<returns>To be added.</returns>
429-
<remarks>To be added.</remarks>
426+
<param name="cancellationToken">A cancellation token that can be used to cancel the asynchronous operation.</param>
427+
<summary>Accepts a pending connection request as a cancellable asynchronous operation.</summary>
428+
<returns>The task object representing the asynchronous operation. The <see cref="P:System.Threading.Tasks.Task`1.Result" /> property on the task object returns a <see cref="T:System.Net.Sockets.Socket" /> used to send and receive data.</returns>
429+
<remarks>
430+
<format type="text/markdown"><![CDATA[
431+
432+
## Remarks
433+
This operation will not block. The returned <xref:System.Threading.Tasks.Task%601> object will complete after the socket connection has been accepted.
434+
435+
The <xref:System.Net.Sockets.Socket> returned in <xref:System.Threading.Tasks.Task%601> is initialized with the IP address and port number of the remote host. You can use any of the <xref:System.Net.Sockets.Socket.Send%2A> and <xref:System.Net.Sockets.Socket.Receive%2A> methods available in the <xref:System.Net.Sockets.Socket> class to communicate with the remote host. When you are finished using the <xref:System.Net.Sockets.Socket>, be sure to call its <xref:System.Net.Sockets.Socket.Close%2A> method. If your application is relatively simple, consider using the <xref:System.Net.Sockets.TcpListener.AcceptTcpClient%2A> method rather than the <xref:System.Net.Sockets.TcpListener.AcceptSocketAsync%2A> method. <xref:System.Net.Sockets.TcpClient> provides you with simple methods for sending and receiving data over a network in blocking synchronous mode.
436+
437+
> [!NOTE]
438+
> This member outputs trace information when you enable network tracing in your application. For more information, see [Network Tracing in the .NET Framework](/dotnet/framework/network-programming/network-tracing).
439+
440+
]]></format>
441+
</remarks>
430442
</Docs>
431443
</Member>
432444
<Member MemberName="AcceptTcpClient">
@@ -571,10 +583,22 @@
571583
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" Index="0" FrameworkAlternate="net-6.0" />
572584
</Parameters>
573585
<Docs>
574-
<param name="cancellationToken">To be added.</param>
575-
<summary>To be added.</summary>
576-
<returns>To be added.</returns>
577-
<remarks>To be added.</remarks>
586+
<param name="cancellationToken">A cancellation token that can be used to cancel the asynchronous operation</param>
587+
<summary>Accepts a pending connection request as a cancellable asynchronous operation.</summary>
588+
<returns>The task object representing the asynchronous operation. The <see cref="P:System.Threading.Tasks.Task`1.Result" /> property on the task object returns a <see cref="T:System.Net.Sockets.TcpClient" /> used to send and receive data.</returns>
589+
<remarks>
590+
<format type="text/markdown"><![CDATA[
591+
592+
## Remarks
593+
This operation will not block. The returned <xref:System.Threading.Tasks.Task%601> object will complete after the TCP connection has been accepted.
594+
595+
Use the <xref:System.Net.Sockets.TcpClient.GetStream%2A?displayProperty=nameWithType> method to obtain the underlying <xref:System.Net.Sockets.NetworkStream> of the returned <xref:System.Net.Sockets.TcpClient> in the <xref:System.Threading.Tasks.Task%601>. The <xref:System.Net.Sockets.NetworkStream> will provide you with methods for sending and receiving with the remote host. When you are through with the <xref:System.Net.Sockets.TcpClient>, be sure to call its <xref:System.Net.Sockets.TcpClient.Close%2A> method. If you want greater flexibility than a <xref:System.Net.Sockets.TcpClient> offers, consider using <xref:System.Net.Sockets.TcpListener.AcceptSocket%2A> or <xref:System.Net.Sockets.TcpListener.AcceptSocketAsync%2A>.
596+
597+
> [!NOTE]
598+
> This member outputs trace information when you enable network tracing in your application. For more information, see [Network Tracing in the .NET Framework](/dotnet/framework/network-programming/network-tracing).
599+
600+
]]></format>
601+
</remarks>
578602
</Docs>
579603
</Member>
580604
<Member MemberName="Active">

0 commit comments

Comments
 (0)