Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

socket IOControl error 10022?

59 views
Skip to first unread message

Tom P

unread,
Jan 22, 2006, 11:02:03 PM1/22/06
to
The following C# code generates a 10022 error. The error indicates an
invalid value was specified...Anybody have any idea what the problem is?

Thx,
Tom
tpal...@collabcon.com

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, null, null);
ret_code = OUT[0] + OUT[1] + OUT[2] + OUT[3];
if(ret_code != 0)
ret_val = false;

Arkady Frenkel

unread,
Jan 23, 2006, 2:21:36 AM1/23/06
to
Seems like you paste not connected parts of your code :
where you use IN,OUT,SIO_RCVALL , that even strange that you receive 10022,
because due to your code you reset received code ( ret_code ) with 0 ,
because in C# new default constructor
set OUT bytes to zero, so ret_code = OUT[0] + OUT[1] + OUT[2] + OUT[3] will
be the same as ret_code = OUT[0] (OTOH don't think that C# will do shifting
for you )
Arkady

"Tom P" <To...@discussions.microsoft.com> wrote in message
news:6A1B8517-4E75-4D21...@microsoft.com...

Tom P

unread,
Jan 23, 2006, 10:11:02 AM1/23/06
to
Sorry, that should have read:

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;


But in either case I get the same error, 10022. 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

Arkady Frenkel

unread,
Jan 24, 2006, 3:52:03 AM1/24/06
to
I believe that you use Framework 2 because that work only there, pay
attention to that socket have to be of raw type
and set IN and OUT to
int i = 1 ;
byte[] IN = BitConverter.GetBytes(i);
byte[] OUT = BitConverter.GetBytes(0);
I have no managed code for you but unmanaged you can see on
www.codeguru.com/network/ipmon.html
Arkady

"Tom P" <To...@discussions.microsoft.com> wrote in message

news:CAF61287-C25A-4C6F...@microsoft.com...

0 new messages