-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Added documentation for System.Net.Sockets APIs targeted for 3.0 #2767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Comments about changes to docs of existing APIs:
|
@dotnet/ncl @mairaw @rpetrusha |
As we discussed it does not return 0 when you close the socket, but it does return 0 -- this happens once you've exhausted all of the data from the socket after the other side does a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reviewed this so far up to the SendPacketsElement(FileStream, Int32, Int32) constructor. I'll submit a separate set of comments/suggestions in a separate review.
-or- | ||
|
||
There is a failure reading from the network.</exception> | ||
The <paramref name="size" /> parameter is greater than the length of <paramref name="buffer" /> minus the value of the <paramref name="offset" /> parameter.</exception> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The <paramref name="size" /> parameter is greater than the length of <paramref name="buffer" /> minus the value of the <paramref name="offset" /> parameter.</exception> | |
<paramref name="size" /> is greater than the length of <paramref name="buffer" /> minus the value of <paramref name="offset" />.</exception> |
<param name="fileStream">The file to be transmitted using the <see cref="M:System.Net.Sockets.Socket.SendPacketsAsync(System.Net.Sockets.SocketAsyncEventArgs)" /> method.</param> | ||
<param name="offset">The offset, in bytes, from the beginning of the file to the location in the file to start sending the bytes in the file.</param> | ||
<param name="count">The number of bytes to send starting from the <paramref name="offset" />. If <paramref name="count" /> is zero, the entire file is sent.</param> | ||
<summary>Initializes a new instance of the <see cref="T:System.Net.Sockets.SendPacketsElement" /> class using the specified <paramref name="fileStream" />, buffer <paramref name="offset" /> and <paramref name="count" />.</summary> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<summary>Initializes a new instance of the <see cref="T:System.Net.Sockets.SendPacketsElement" /> class using the specified <paramref name="fileStream" />, buffer <paramref name="offset" /> and <paramref name="count" />.</summary> | |
<summary>Initializes a new instance of the <see cref="T:System.Net.Sockets.SendPacketsElement" /> class using the specified <range of a <see cref="T:System.IO.FileStream" /> object.</summary> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want me to replace
the specified filestream, buffer offset and count.
for
the specified range of a filestream object.
Shouldn't we also apply that to ALL the rest of existing overloads, including the ones taking a byte[]
and a string
filename path? i.e: look at summary in the above overload:
<summary>Initializes a new instance of the <see cref="T:System.Net.Sockets.SendPacketsElement" /> class using the specified buffer, buffer offset, and count.</summary> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we should make the replacement elsewhere, @jozkee.
<format type="text/markdown"><![CDATA[ | ||
|
||
## Remarks | ||
This constructor initializes a new instance of the <xref:System.Net.Sockets.SendPacketsElement> class using a <xref:System.IO.FileStream> object. 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This constructor initializes a new instance of the <xref:System.Net.Sockets.SendPacketsElement> class using a <xref:System.IO.FileStream> object. 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. | |
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question as above, this paragraph is in every single overload.
The <xref:System.Net.Sockets.SendPacketsElement.%23ctor%28System.Byte%5B%5D%2CSystem.Int32%2CSystem.Int32%29> constructor initializes a new instance of the <xref:System.Net.Sockets.SendPacketsElement> class with a byte array of data. 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should try to disambiguate. For example, buffer offsets are 32-bit and 64-bit, and both are represented. The remaining param name in the constriuctor list can also be replaced.
Removed "%2A" from properties. On ReadAsync(System.Memory{System.Byte},System.Threading.CancellationToken), removed unnecessary exceptions.
I've addresssed Ron comments. This is ready for re-review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, @jozkee. I left three more comments, two in response to your questions and a suggested change in response to the comment from @scalablecory.
* standarizing summaries of SendPacketElements.ctors * Adding note to SafeSocketHandle, related to dotnet/corefx#39677
This looks good, @jozkee. Thanks for making the additional changes. I'll merge your PR now. |
…lySpan{System.Byte}) After adding documentation for System.Net.Sockets in dotnet#2767, we found out that one param went away with no proper description. This change adds the missing description to it.
List of APIs documented:
AddresFamily - Added support for new Linux protocols initial support for new network protocols corefx#37315
ProtocolFamily
NetworkStream - Added a bunch of span overloads. Also did some corrections to current documentation.
SafeSocketHandle - Added Socket.SafeHandle dotnet/corefx#13470
Socket
SendPacketsElement - Added FileStream and Int64 OffsetLong support dotnet/corefx#25354
SocketOptionName - Added support for TcpKeepAlive options dotnet/corefx#25040
I literally copied the summaries from https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-tcp-socket-options