在下面的代码上
Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.IP);
s.Bind(new System.Net.IPEndPoint(IPAddress.Parse("127.0.0.1"),0));
s.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.HeaderIncluded, true);
byte[] bin = new byte[4]{1, 0, 0, 0};
byte[] bout = new byte[4];
s.IOControl(IOControlCode.ReceiveAll, bin, bout);
我得到以下异常:
Socket Exception: An invalid argument was supplied
在下一行
s.IOControl(IOControlCode.ReceiveAll, in, out);
但我不明白为什么我提供了错误的论点。