Help with ioctlsocket

This is a discussion on Help with ioctlsocket within the Networking/Device Communication forums, part of the General Programming Boards category; I get error 10022 Invalid argument after calling ioctlsocket, any ideas why? Here is the code. Code: unsigned long ulMode ...

  1. #1
    Registered User
    Join Date
    Mar 2005
    Posts
    10

    Help with ioctlsocket

    I get error 10022 Invalid argument after calling ioctlsocket, any ideas why? Here is the code.

    Code:
    unsigned long ulMode = 1;
    WSADATA wsaSock;
    SOCKET mySocket;
    
      WSAStartup(MAKEWORD(2,1),&wsaSock);
      
    
      mySocket = socket(AF_INET,SOCK_RAW,IPPROTO_IP);
      
    
      bind(mySocket,(SOCKADDR *) &myAddr,sizeof(myAddr));
      
    
      if (ioctlsocket(mySocket, SIO_RCVALL, &ulMode) == SOCKET_ERROR) {
          cout << "SOCKET ERROR\n";
          erCode = WSAGetLastError();
          cout << "Error: " << erCode << "\n";
      }
    Thanks in advance

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    I just read through the documention for the ioctlsocket() function, and it doesn't say anywhere that SIO_RCVALL is a valid parameter to pass.

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,485
    1. Check your return results.
    2. Windows sockets is pretty weak compared to a complete *ix implementation, so expect surprises if you're trying to do something "outside the usual box".
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User
    Join Date
    Mar 2005
    Posts
    10
    Quote Originally Posted by bithub
    I just read through the documention for the ioctlsocket() function, and it doesn't say anywhere that SIO_RCVALL is a valid parameter to pass.
    If your refering to MSDN, a little further down in the documentation it states that those 3 parameters are vaild for winsock V 1.1 but many more are supported in 2.0, which can be found in the documentation for WSAIoctl

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Where does the name 'ioctlsocket' come from?
    By hardi in forum Networking/Device Communication
    Replies: 3
    Last Post: 12-17-2006, 03:22 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21