dotnet / dotnet/dotnet-api-docs
Document which SocketType is required for each ProtocolType
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
[The documentation for the `Socket` constructor](https://docs.microsoft.com/en-us/dotnet/api/system.net.sockets.socket.-ctor?view=netframework-4.7#System_Net_Sockets_Socket__ctor_System_Net_Sockets_AddressFamily_System_Net_Sockets_SocketType_System_Net_Sockets_ProtocolType_) says:
> The `addressFamily` parameter specifies the addressing scheme that the `Socket` class uses, the `socketType` parameter specifies the type of the `Socket` class, and the `protocolType` parameter specifies the protocol used by `Socket`. The three parameters are not independent. Some address families restrict which protocols can be used with them, and often the `Socket` type is implicit in the protocol. If the combination of address family, `Socket` type, and protocol type results in an invalid `Socket`, this constructor throws a `SocketException`.
It doesn't explain how to find out which combination of the three parameters work together, except for "try it and see if it throws". I think this is not sufficient and that valid combinations for the three parameters should be documented.
---
#### Document Details
⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*
* ID: 3d2161f0-52ad-b8b3-bfce-1756759cb449
* Version Independent ID: 21d3c8da-b0bb-b4e5-6696-4b61a7e7dbe4
* Content: [Socket Constructor (System.Net.Sockets)](https://docs.microsoft.com/en-us/dotnet/api/system.net.sockets.socket.-ctor?view=netframework-4.7#System_Net_Sockets_Socket__ctor_System_Net_Sockets_AddressFamily_System_Net_Sockets_SocketType_System_Net_Sockets_ProtocolType_)
* Content Source: [xml/System.Net.Sockets/Socket.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.Net.Sockets/Socket.xml)
* Product: **dotnet-api**
* GitHub Login: @karelz
* Microsoft Alias: **ncldev**
Contributor guide
Assessment
This issue has not been assessed yet.