Socket.IOControl() error # 10022 in Visual Studio 2005?
-
The following is code written in C# using .NET Framework 2.0 and VS 2005. I'm getting an exception, error #10022, when I call IOControl(). I tried different values for the parameters to IOControl(), and still get the same error. Can anybody help clear this up as to why I'm getting this error? Thx, T socket.SetSocketOption(SocketOptionLevel.IP,SocketOptionName.HeaderIncluded,1); byte []IN = new byte[4]{1, 0, 0, 0}; byte []OUT = new byte[4]; int SIO_RCVALL = unchecked((int)0x98000001); int ret_code = socket.IOControl(IOControlCode.ReceiveAll, IN, OUT); ret_code = OUT[0] + OUT[1] + OUT[2] + OUT[3]; if(ret_code != 0) ret_val = false;
-
The following is code written in C# using .NET Framework 2.0 and VS 2005. I'm getting an exception, error #10022, when I call IOControl(). I tried different values for the parameters to IOControl(), and still get the same error. Can anybody help clear this up as to why I'm getting this error? Thx, T socket.SetSocketOption(SocketOptionLevel.IP,SocketOptionName.HeaderIncluded,1); byte []IN = new byte[4]{1, 0, 0, 0}; byte []OUT = new byte[4]; int SIO_RCVALL = unchecked((int)0x98000001); int ret_code = socket.IOControl(IOControlCode.ReceiveAll, IN, OUT); ret_code = OUT[0] + OUT[1] + OUT[2] + OUT[3]; if(ret_code != 0) ret_val = false;
10022 means Invalid Argument in the Sockets API docs, here[^]. One of the parameters you sent wasn't correct for the mode you've setup or was just plain grabage. You might want to check the parameters you're sending against the docs[^] for WSAIoCtl. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
10022 means Invalid Argument in the Sockets API docs, here[^]. One of the parameters you sent wasn't correct for the mode you've setup or was just plain grabage. You might want to check the parameters you're sending against the docs[^] for WSAIoCtl. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
Dave, I knew that the error means Invalid Argument, but looking at the docs for WSAIoCtl, the values I'm passing in all seem valid. Socket.RcvAll is a constant in .NET, and the other two are optional values. Every other code snippet i've seen has similar values for IoControl(). Any other thoughts? Thx, Tom
-
Dave, I knew that the error means Invalid Argument, but looking at the docs for WSAIoCtl, the values I'm passing in all seem valid. Socket.RcvAll is a constant in .NET, and the other two are optional values. Every other code snippet i've seen has similar values for IoControl(). Any other thoughts? Thx, Tom
Since the ReceiveAll option requires the socket type be RAW, would your machine happen to be running Windows XP SP1 or SP2? Are you developing this under an Admin equivilent account? You might also find this[^] a bit interesting. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome -- modified at 12:31 Monday 23rd January, 2006
-
Since the ReceiveAll option requires the socket type be RAW, would your machine happen to be running Windows XP SP1 or SP2? Are you developing this under an Admin equivilent account? You might also find this[^] a bit interesting. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome -- modified at 12:31 Monday 23rd January, 2006
Yes, Windows XP SP2 and under an Admin privileged account. Does that mean it can't be done?
-
Yes, Windows XP SP2 and under an Admin privileged account. Does that mean it can't be done?
It can be done. Under XP, you have to jump through all these hoops to get it to work. Look at the second link I posted and there's a link at the bottom of that page. Make sure all your ducks are in a row, per those pages, and you should be OK. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
It can be done. Under XP, you have to jump through all these hoops to get it to work. Look at the second link I posted and there's a link at the bottom of that page. Make sure all your ducks are in a row, per those pages, and you should be OK. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
Dave, If I'm following the links you are talking about correctly, one of them mentions turning on ICF if running SP1, and the other mentions if u want to use raw sockets without restriction, use Windows 2003 Server. In both cases it seems as if the issue is with sending data on Raw sockets. In my example, i'm actually trying to receive data on raw sockets. So, given that, it seems like it should work. This error is preventing me from proceeding. Any other thoughts on how to solve this? Also, Thanks again for your help to this point. Tom