Question : URGENT HELP!  Trouble discovering devices using winsock bluetooth.  Please help!

Hi everyone,

I'm trying to write a PocketPC2003 application for an iPAQ that supports bluetooth.  I've gone through the MS docs on using winsock for this purpose and so far I have written this:

// WSAStartup code done

INT iResult = 0;
LPWSAQUERYSET pwsaResults;
DWORD dwSize = 0;
WSAQUERYSET wsaq;
HANDLE hLookup = 0;
memset (&wsaq, 0, sizeof(wsaq));
wsaq.dwSize = sizeof(WSAQUERYSET);
wsaq.dwNameSpace = NS_ALL;
wsaq.lpcsaBuffer = NULL;

iResult = WSALookupServiceBegin(&wsaq, LUP_CONTAINERS, &hLookup);

union {
CHAR buf[5000];
SOCKADDR_BTH     __unused;
};

pwsaResults = (LPWSAQUERYSET) buf;
dwSize  = sizeof(buf);          
memset(pwsaResults,0,sizeof(WSAQUERYSET));
pwsaResults->dwSize      = sizeof(WSAQUERYSET);
pwsaResults->dwNameSpace = NS_BTH;
pwsaResults->lpBlob      = NULL;

iResult = WSALookupServiceNext (hLookup, LUP_RETURN_NAME | LUP_RETURN_ADDR, &dwSize, pwsaResults);

i know i didn't show any error checking here.. but basically the problem is the last line.  WSALookupServiceBegin returns properly with a valid handle, but when I call WSALookupServiceNext, i get a 10050 Errorcode which translates to "Network is down. A socket operation encountered a dead network. This could indicate a serious failure of the network system (that is, the protocol stack that the Windows Sockets DLL runs over), the network interface, or the local network itself".  I know the network component is working properly on the iPAQ because I can connect to bluetooth devices on it using the Bluetooth Manager... but just not using my own winsock calls.  Am i missing anything else?  or can someone please help me out on how to discovery bluetooth devices?  Any help is greatly appreciated.  Thanks a lot.

Answer : URGENT HELP!  Trouble discovering devices using winsock bluetooth.  Please help!

I don't think this is going to work with the IPAQ. The Microsoft Documentation is written for their own stack. Products like the MC9000 by Symbol Technologies uses the Microsoft Bluetooth stack.
The IPAQ however uses a different stack from a company called WidComm.  They sell their SDK on their website.
Hope this helps,
Cindy
Random Solutions  
 
programming4us programming4us