954,167 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Bluetooth development using platform SDK - error code 10050

Hello,

I've been trying to develop a simple client/server application that uses the bluetooth USB dongles of 2 PCs using windows sockets and the bluetooth support provided in the windows platform SDK

I can create the sockets fine, but when I go to invoke "bind" or "connect", the program spits out the error code 10050 (network is down/dead), but I can't figure out where the problem is or what is causing it (everywhere on the net is very vague about this error)

Any ideas?

Thanks

I am including a portion of my code up until when the program exits

#include <winsock2.h>
#include <ws2bth.h>
#include <BluetoothAPIs.h>
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#pragma comment(lib, "ws2_32.lib")
#pragma comment(lib, "irprops.lib")
using namespace std;

int main()
{
	//Initialising winsock
	WSADATA data;
	int result;
	result = WSAStartup(MAKEWORD(2, 2), &data);//initializing winsock
	if (result!=0)
	{
		cout << "An error occured while initialising winsock, closing....";
		exit(result);
	}
	
	SOCKET s = socket (AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM);
	if (s == INVALID_SOCKET)
	{
		wprintf (L"Socket creation failed, error %d\n", WSAGetLastError ());
		return 0;
	}

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

	if (0 != bind (s, (struct sockaddr *) &sab, sizeof(SOCKADDR_BTH)))
	{
		wprintf (L"Socket bind, error %d\n", WSAGetLastError ());
		closesocket (s);
		return 0;
	}


The error occurs at "Socket bind, error"
I should also add that hte bluetooth usb dongles have been tested and work, and I'm running all this on windows XP with SP2, and using visual studio 2005 team suite

Exenteth
Newbie Poster
1 post since Jan 2008
Reputation Points: 10
Solved Threads: 0
 

I tried the code that you posted and it worked just fine for me.

Z.K.

Z.K.
Newbie Poster
1 post since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

I tried the code that you posted and it worked just fine for me.

Z.K.


Symptom: When attempting to verify network connectivity with a remote computer by using the Ping.exe command, you may receive a command-line error message similar to the following: Ping: transmit failed, error code 65 or PING: transmit failed, error code 10050.

Resolutions: This behavior can occur if the following conditions are true: 1) ICS is enabled; 2) a firewall software is running on the computer; 3) The ZoneLabs program is not correctly configured for ICS.

To fix the problem: 1) re-configure ZoneAlarm for ICS. 2) Remove the Zone Labs firewall software from the computer.


what i am bale to get on net and of this some think which i know.

himanshu anand
Newbie Poster
4 posts since Nov 2007
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You