Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Socket.SendToAsync(SocketAsyncEventArgs) now updates the value of the Socket.LocalEndPoint property to the socket's local address.
Version introduced
5.0
Change description
In previous .NET versions, Socket.SendToAsync(SocketAsyncEventArgs) does not alter the value of the Socket.LocalEndPoint property on the socket instance. Starting in .NET 5, when SendToAsync(SocketAsyncEventArgs) successfully completes, the value of Socket.LocalEndPoint is the implicitly bound socket's local address. This new behavior is consistent with the behavior of SendTo(Byte[], EndPoint) and BeginSendTo(Byte[], Int32, Int32, SocketFlags, EndPoint, AsyncCallback, Object)/EndSendTo(IAsyncResult).
Reason for change
This change fixes a bug and makes the behavior consistent across SendTo
variants.
Recommended action
Alter any code that assumes that SendToAsync(SocketAsyncEventArgs) won't alter the value of Socket.LocalEndPoint.