我正在尝试在C#.Net中为我的UDP套接字设置一个选项。我很确定我正在做微软文件所说的一切;然而它抛出一个''无效参数被提供'例外。
Socket socket;
socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
socket.Bind(new IPEndPoint(IPAddress.Any, port));
// MUST BE BIND FIRST BEFORE SETTING OPTIONS!
// To find out what option can be used with what:
// https://msdn.microsoft.com/en-us/library/1011kecd(v=vs.110).aspx
socket.SetSocketOption(SocketOptionLevel.Udp, SocketOptionName.NoChecksum, 0);
socket.SetSocketOption(SocketOptionLevel.Udp, SocketOptionName.ChecksumCoverage, 1);
将SocketOptionName.ChecksumCoverage选项设置为1或true时,会抛出异常。我查看了文件,应该是有效的论据。我做错了什么?