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. C / C++ / MFC
  4. Winsock problem in 64 bit windows

Winsock problem in 64 bit windows

Scheduled Pinned Locked Moved C / C++ / MFC
helpsysadminwindows-adminquestion
3 Posts 3 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.
  • V Offline
    V Offline
    Varghese Paul M
    wrote on last edited by
    #1

    Hi everybody, The line of code

    SOCKET sock = socket(AF_NETBIOS, SOCK_DGRAM, 0);

    works fine in windows XP 32 bit but fails in windows server 2003 enterprise 64 Bit. The WSAGetLastError() returns error code 10047. Any idea where I am going wrong? The code is given below which prints "Success" in 32 bit OS but prints Error: 10047 in 64 bit OS

    void main()
    {
    WSADATA sockdata;
    WORD wVersionRequested = MAKEWORD(2, 2);

    int stat = WSAStartup(wVersionRequested,&sockdata);
    if(stat != 0)
    {
    	printf("Error initializing winsock\\r\\n");
    	return;
    }
    
    SOCKET sock = socket(AF\_NETBIOS, SOCK\_DGRAM, 0);
    DWORD errcode = WSAGetLastError();
    
    if(sock != INVALID\_SOCKET)
    {
    	closesocket(sock);
    	printf("Success\\r\\n");
    }
    else
    {
    	printf("\\r\\nError: %d\\r\\n",errcode);
    }
    WSACleanup();
    

    }

    cheers Varghese Paul

    L C 2 Replies Last reply
    0
    • V Varghese Paul M

      Hi everybody, The line of code

      SOCKET sock = socket(AF_NETBIOS, SOCK_DGRAM, 0);

      works fine in windows XP 32 bit but fails in windows server 2003 enterprise 64 Bit. The WSAGetLastError() returns error code 10047. Any idea where I am going wrong? The code is given below which prints "Success" in 32 bit OS but prints Error: 10047 in 64 bit OS

      void main()
      {
      WSADATA sockdata;
      WORD wVersionRequested = MAKEWORD(2, 2);

      int stat = WSAStartup(wVersionRequested,&sockdata);
      if(stat != 0)
      {
      	printf("Error initializing winsock\\r\\n");
      	return;
      }
      
      SOCKET sock = socket(AF\_NETBIOS, SOCK\_DGRAM, 0);
      DWORD errcode = WSAGetLastError();
      
      if(sock != INVALID\_SOCKET)
      {
      	closesocket(sock);
      	printf("Success\\r\\n");
      }
      else
      {
      	printf("\\r\\nError: %d\\r\\n",errcode);
      }
      WSACleanup();
      

      }

      cheers Varghese Paul

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Error code 10047 states: "An address incompatible with the requested protocol was used.". Are you sure that the lana address value in your socket() call is correct? See the description here[^] for an explanation.

      txtspeak is the realm of 9 year old children, not developers. Christian Graus

      1 Reply Last reply
      0
      • V Varghese Paul M

        Hi everybody, The line of code

        SOCKET sock = socket(AF_NETBIOS, SOCK_DGRAM, 0);

        works fine in windows XP 32 bit but fails in windows server 2003 enterprise 64 Bit. The WSAGetLastError() returns error code 10047. Any idea where I am going wrong? The code is given below which prints "Success" in 32 bit OS but prints Error: 10047 in 64 bit OS

        void main()
        {
        WSADATA sockdata;
        WORD wVersionRequested = MAKEWORD(2, 2);

        int stat = WSAStartup(wVersionRequested,&sockdata);
        if(stat != 0)
        {
        	printf("Error initializing winsock\\r\\n");
        	return;
        }
        
        SOCKET sock = socket(AF\_NETBIOS, SOCK\_DGRAM, 0);
        DWORD errcode = WSAGetLastError();
        
        if(sock != INVALID\_SOCKET)
        {
        	closesocket(sock);
        	printf("Success\\r\\n");
        }
        else
        {
        	printf("\\r\\nError: %d\\r\\n",errcode);
        }
        WSACleanup();
        

        }

        cheers Varghese Paul

        C Offline
        C Offline
        cmk
        wrote on last edited by
        #3

        http://msdn.microsoft.com/en-us/library/bb870913(VS.85).aspx[^] "Netbios is not supported on Windows Vista, Windows Server 2008, and subsequent versions of the operating system." Maybe that list should include Win2003 x64 as well.

        ...cmk The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying. - John Carmack

        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