Skip to content
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

Relaxing IsConnected Check for Datagram Sockets #87916

Merged
merged 8 commits into from
Jul 17, 2023

Conversation

liveans
Copy link
Member

@liveans liveans commented Jun 22, 2023

Fixes #77962

.NET Framework's behavior may be different for SocketType.Stream, but this PR will match the behavior for other socket types.

According to linux connect man page

Some protocol sockets (e.g., datagram sockets in the UNIX and
Internet domains) may use connect() multiple times to change
their association.

According to WinSock2 connect api

For a connectionless socket:
The default destination can be changed by simply calling connect again, even if the socket is already connected.

According to OSX connect man page:

Each communications space interprets the address parameter in its own
way.  Generally, stream sockets may successfully connect() only once;
datagram sockets may use connect() multiple times to change their association. 
Datagram sockets may dissolve the association by connecting to an
invalid address, such as a null address or an address with the address
family set to AF_UNSPEC (the error EAFNOSUPPORT will be harmlessly
returned).

@ghost
Copy link

ghost commented Jun 22, 2023

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes #77962

Author: liveans
Assignees: -
Labels:

area-System.Net.Sockets

Milestone: -

@liveans liveans requested a review from a team June 22, 2023 09:44
@stephentoub
Copy link
Member

Looks like this was introduced as part of another bug fix in dotnet/corefx#27173

@liveans liveans marked this pull request as draft June 22, 2023 10:57
@liveans liveans marked this pull request as ready for review June 25, 2023 14:45
@liveans
Copy link
Member Author

liveans commented Jun 28, 2023

/azp run runtime-libraries-coreclr outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@liveans liveans merged commit fecdb74 into dotnet:main Jul 17, 2023
103 checks passed
@liveans liveans deleted the relax-is-connected-check-for-datagram branch July 17, 2023 19:42
@karelz karelz added this to the 8.0.0 milestone Aug 1, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Aug 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UDP socket cannot be disconnected with Connect(IPAddress.Any, 0)
5 participants