This project has moved. For the latest updates, please go here.

PortLookup_Zero

Topics: Bluetooth - Microsoft, Samples
Oct 1, 2012 at 3:14 PM

I am using this code from samples and have error PortLookup_Zero on this line  localBTClient.Connect(ep), no matter what service I select. devices[2] is my Samsung mobile phone. What I am doing wrong? Please help. Thanks

Here is the code:

  BluetoothClient me = new BluetoothClient();

 BluetoothDeviceInfo[] devices = me.DiscoverDevices();

BluetoothClient localBTClient = new BluetoothClient();

Guid spguid = BluetoothService.RFCommProtocol;

InTheHand.Net.BluetoothEndPoint ep = new InTheHand.Net.BluetoothEndPoint(devices[2].DeviceAddress, spguid);

localBTClient.Connect(ep);

Developer
Oct 19, 2012 at 2:34 PM

We connect to the device to ask it which port number the specified Service is active on. We get zero results. Which shows that the phone isn't running that service.

If you just wish to see if that device is present then do a simple (dummy) SDP lookup, see http://32feet.codeplex.com/wikipage?title=Testing if a device is in range