You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After setting / using SocketAsyncEventArgs.BufferList we should be able to revert to single-buffer mode by calling:
saea.BufferList=null;saea.SetBuffer(...);
While working on UDP test harmonization, I discovered that this does not work with ReceiveMessageFrom on Linux. Haven't checked other Unixes.
Repro:
[Fact]publicvoidReceiveMessageFromIssue(){usingvarreceiver=newSocket(AddressFamily.InterNetwork,SocketType.Dgram,ProtocolType.Udp);usingvarsender=newSocket(AddressFamily.InterNetwork,SocketType.Dgram,ProtocolType.Udp);usingvarsaea=newSocketAsyncEventArgs();varcompleted=newManualResetEventSlim();saea.Completed+=delegate{completed.Set();};receiver.Bind(newIPEndPoint(IPAddress.Loopback,0));sender.Bind(newIPEndPoint(IPAddress.Loopback,0));saea.RemoteEndPoint=newIPEndPoint(IPAddress.Any,0);// Commenting out the following line makes the issue disappear:saea.BufferList=newList<ArraySegment<byte>>{newArraySegment<byte>(newbyte[1])};saea.BufferList=null;saea.SetBuffer(newbyte[1024],0,1024);sender.SendTo(newbyte[1024],receiver.LocalEndPoint);if(receiver.ReceiveMessageFromAsync(saea))Assert.True(completed.Wait(1000),"Expected operation to complete within timeout");// Fails on Linux, works on Windows:Assert.Equal(1024,saea.BytesTransferred);}
The text was updated successfully, but these errors were encountered:
Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.
Issue Details
After setting / using SocketAsyncEventArgs.BufferList we should be able to revert to single-buffer mode by calling:
saea.BufferList=null;saea.SetBuffer(...);
While working on UDP test harmonization, I discovered that this does not work with ReceiveMessageFrom on Linux. Haven't checked with other Unixes.
Repro:
[Fact]publicvoidReceiveMessageFromIssue(){usingvarreceiver=newSocket(AddressFamily.InterNetwork,SocketType.Dgram,ProtocolType.Udp);usingvarsender=newSocket(AddressFamily.InterNetwork,SocketType.Dgram,ProtocolType.Udp);usingvarsaea=newSocketAsyncEventArgs();varcompleted=newManualResetEventSlim();saea.Completed+=delegate{completed.Set();};receiver.Bind(newIPEndPoint(IPAddress.Loopback,0));sender.Bind(newIPEndPoint(IPAddress.Loopback,0));saea.RemoteEndPoint=newIPEndPoint(IPAddress.Any,0);// Commenting out the following line makes the issue disappear:saea.BufferList=newList<ArraySegment<byte>>{newArraySegment<byte>(newbyte[1])};saea.BufferList=null;saea.SetBuffer(newbyte[1024],0,1024);sender.SendTo(newbyte[1024],receiver.LocalEndPoint);if(receiver.ReceiveMessageFromAsync(saea))Assert.True(completed.Wait(1000),"Expected operation to complete within timeout");// Fails on Linux, works on Windows:Assert.Equal(1024,saea.BytesTransferred);}
After setting / using
SocketAsyncEventArgs.BufferList
we should be able to revert to single-buffer mode by calling:While working on UDP test harmonization, I discovered that this does not work with
ReceiveMessageFrom
on Linux. Haven't checked other Unixes.Repro:
The text was updated successfully, but these errors were encountered: