-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Socket LocalEndPoint not updated in SendToAsync(SocketAsyncEventArgs e) #915
Comments
Seems like a bug to me (disclaimer: I don't have much expertise in that code, so I may be wrong). |
I'm unfortunately not an expert in this source either, I'd prefer that a more experienced person have a look over this to make sure the right solution is provided considering this is very low core level code that may potentially break several server implementations and frameworks. |
Triage: We should check .NET Framework behavior. How does it behave on Linux? |
I can confirm, that this behavior is also reproducible on Linux and .NET Framework. If we fix the issue, we break consistency. |
Can we get the correct (i.e. fixed) behavior consistent across .NET Core (Windows/Linux/Mac)? That would be the priority. It's probably ok if we have dissimilar behavior on .NET Framework. We can document that difference on docs.microsoft.com. |
@davidsh the code responsible for this doesn't seem platform specific to me, so it is easy to keep it consistent for .NET Core. Note: I wonder if there any guidelines (or at least precedents) for introducing behavioral deviations between .NET Core and .NET Framework? |
The
SocketAsyncEventArgs
version ofSendToAsync
does not properly set_rightEndPoint
, while it creates theendPointSnapshot
variable that is used to set_rightEndPoint
inSendTo
,BeginSendTo
andSendToAsync (task)
methods.According to remarks section of the documentation on recvfrom method, all of
sendto
,WSASendTo
andWSAJoinLeaf
implicitly binds to a local address which is reflected by callinggetsockname
.Here is a reference link for Socket.cs with line number.
https://github.com/dotnet/corefx/blob/master/src/System.Net.Sockets/src/System/Net/Sockets/Socket.cs#L4213
Otherwise it is in
public bool SendToAsync(SocketAsyncEventArgs e)
method.Example code for reproducing issue
The text was updated successfully, but these errors were encountered: