Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: Mon, 24 Sep 2007 18:08:50 -0700,    group: microsoft.public.platformsdk.networking        back       


WSALookupServiceBegin problem in Bluetooth!   
Hello,

  I have just started playing with a Bluetooth Device (Manufacturer: IVT Corp.) and its driver is digitally signed by Microsoft Windows Hardware Compatibility Publisher. I am using Winodws XP and Visual Studio 2005 with Windows Server 2003 R2 SDK.

  I am running the following code to interface with my Bluetooth Dongle:

    #include <winsock2.h>

    #include <Ws2bth.h>

    #include <bthdef.h>

    #include <BluetoothAPIs.h>

    #include <stdio.h>

    #include <conio.h>

    #pragma comment(lib, "ws2_32.lib")

    #pragma comment(lib, "irprops.lib")





    int main(int argc, char* argv[])

    {

    WORD wVersionRequested;

    WSADATA m_data;

    wVersionRequested = MAKEWORD( 2, 0 );


    if (0 == ::WSAStartup(wVersionRequested, &m_data))

    {

      SOCKET s = ::socket(AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM); 

      const DWORD lastError = ::GetLastError();

      if (s == INVALID_SOCKET)

      {

        printf("Failed to get bluetooth socket! %s\n", GetLastErrorMessage(lastError));

        exit(1);

      }

      WSAPROTOCOL_INFO protocolInfo;

      int protocolInfoSize = sizeof(protocolInfo);

      if (0 != getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, (char*)&protocolInfo, &protocolInfoSize))

      {

        exit(1);

      }


      WSAQUERYSET querySet;

      memset(&querySet, 0, sizeof(querySet));

      querySet.dwSize = sizeof(querySet);

      querySet.dwNameSpace = NS_BTH;

      HANDLE hLookup;

      DWORD flags = LUP_RETURN_NAME | LUP_CONTAINERS | LUP_RETURN_ADDR | LUP_FLUSHCACHE | LUP_RETURN_TYPE | LUP_RETURN_BLOB | LUP_RES_SERVICE;

      int result = WSALookupServiceBegin(&querySet, flags, &hLookup);

      if (result == SOCKET_ERROR)

        int iError = WSAGetLastError();

      .......................

      ........................

    }

  }

  And it is always returning from WSALookupServiceBegin with an error code 10108.

  Please help me in this regard!!!

Thanks,

Mudassir Rasool
date: Mon, 24 Sep 2007 18:08:50 -0700   author:   Mudassir Rasool

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us