Networking Forums

Networking Forums > Wireless Networking > Wireless Networks > Bluetooth bind() fails with WSANETDOWN

Reply
Thread Tools Display Modes

Bluetooth bind() fails with WSANETDOWN

 
 
Brown Dwarf
Guest
Posts: n/a

 
      04-10-2006, 06:32 PM


Hello there,
This is the first time I'm probramming for bluetooth.
I installed a USB bluetooth device and the software comes with it works
great, detecting other devices and communicates.

Now I'm developing an bluetooth application to run in server mode (using
WSASetService).
But it fails at bind() with WSANETDOWN. Any idea how to troubleshoot this ??

Platform: WindowsXp-SP2, MSVC6

SOCKET s = ::socket(AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM);
DWORD lastError = ::WSAGetLastError();
if (s == INVALID_SOCKET)
{
printf("Failed to get bluetooth socket! %s\n",
GetLastErrorMessage(lastError));
exit(1);
}

SOCKADDR_BTH sbth;
memset(&sbth, 0, sizeof(sbth));
sbth.addressFamily = AF_BTH;
sbth.btAddr = 0;
sbth.port = BT_PORT_ANY;

if (bind(s, (const sockaddr*)&sbth, sizeof(SOCKADDR_BTH)) == SOCKET_ERROR)
// <<------ here is the problem
{
lastError = ::WSAGetLastError(); // always WSANETDOWN
printf("Failed to bind bluetooth socket! %s\n",
GetLastErrorMessage(lastError));
exit(1);
}


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a Bluetooth PCI card that is *just* bluetooth (and not combowifi) ? Sum Guy Wireless Internet 17 06-09-2009 12:41 AM
Bluetooth Places vs. Bluetooth Devices - Radio not plugged in? Mike Miller Wireless Networks 2 03-08-2008 07:41 PM
how to add a bluetooth device on a bluetooth laptop fifo611 Wireless Networks 1 07-05-2006 08:53 PM
ICS fails with with Bluetooth Network Bodo Wireless Networks 0 05-12-2006 08:32 PM
Logitech Bluetooth headset says I have wrong Bluetooth Stack Sproxton Wireless Networks 0 09-04-2005 10:13 PM



1 2 3 4 5 6 7 8 9 10 11