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
I noticed a crash when using SendTo and ReceiveFrom with sockets that have SendTimeout or ReceiveTimeout values set. As an example, the following code throws an ArgumentOutOfRange exception:
// Wait for DHCPwhile(IPAddress.GetDefaultLocalAddress()== IPAddress.Any)
Thread.Sleep(50);// Set up a sample IP endpointIPAddressip= Dns.GetHostEntry("time-a.nist.gov").AddressList[0];EndPointremoteEndPoint=new IPEndPoint(ip,123);// Set up a send/receive buffer with sample databyte[]buffer=newbyte[48];
buffer[0]=0x1B;using(Socketsocket=new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)){
socket.SendTimeout =1000;
socket.ReceiveTimeout =1000;
socket.SendTo(buffer, remoteEndPoint);
socket.ReceiveFrom(buffer,ref remoteEndPoint);}
If you comment out the SendTimeout line, the call to SendTo completes successfully. Similarly, commenting out the ReceiveTimeout line makes the ReceiveFrom call complete successfully.
This issue does not appear to be present when using the Send/Receive methods.
Please let me know if you need any more information. Thanks!
The text was updated successfully, but these errors were encountered:
I noticed a crash when using
SendTo
andReceiveFrom
with sockets that haveSendTimeout
orReceiveTimeout
values set. As an example, the following code throws anArgumentOutOfRange
exception:If you comment out the
SendTimeout
line, the call toSendTo
completes successfully. Similarly, commenting out theReceiveTimeout
line makes theReceiveFrom
call complete successfully.This issue does not appear to be present when using the
Send
/Receive
methods.Please let me know if you need any more information. Thanks!
The text was updated successfully, but these errors were encountered: