Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. Socket.IOControl() error # 10022 in Visual Studio 2005?

Socket.IOControl() error # 10022 in Visual Studio 2005?

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpvisual-studiohelpdotnetquestion
7 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tom Paluzzi
    wrote on last edited by
    #1

    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;

    D 1 Reply Last reply
    0
    • T Tom Paluzzi

      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;

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      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

      T 1 Reply Last reply
      0
      • D Dave Kreskowiak

        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

        T Offline
        T Offline
        Tom Paluzzi
        wrote on last edited by
        #3

        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

        D 1 Reply Last reply
        0
        • T Tom Paluzzi

          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

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          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

          T 1 Reply Last reply
          0
          • D Dave Kreskowiak

            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

            T Offline
            T Offline
            Tom Paluzzi
            wrote on last edited by
            #5

            Yes, Windows XP SP2 and under an Admin privileged account. Does that mean it can't be done?

            D 1 Reply Last reply
            0
            • T Tom Paluzzi

              Yes, Windows XP SP2 and under an Admin privileged account. Does that mean it can't be done?

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              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

              T 1 Reply Last reply
              0
              • D Dave Kreskowiak

                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

                T Offline
                T Offline
                Tom Paluzzi
                wrote on last edited by
                #7

                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

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups