Skip to content

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).

@liveans liveans requested a review from antonfirsov June 22, 2023 09:44
@ghost ghost assigned liveans Jun 22, 2023
@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
@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