Thread: Help with ioctlsocket

  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,268
    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 int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    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.

  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, 04:22 AM