1

I can't get my java application to connect to a specific bluetooth device. The device is a self build thing and works fine. Until now, my application used a serial port connection to the device, which worked perfectly. The bad thing about that was just that I was not able to automatically detect which COM-Port the device is connected to. Thus the user had to look it up in the device manager and put that in manually. Some weeks later I programmed an android app which connected to the same device. This used a direct bluetooth connection and everything worked so well that I wanted to try this out in my desktop application using the bluecove library (simply because it's free and seemed to be what I needed).

I am able to discover the device, to discover the service and to retrieve the url from that service. All right so far, but when I'm trying to open the connection according to several examples I found on the web, it always gives me a BluetoothConnectionException at the Connector.open(url) part of my code:

String url = service.getConnectionURL(ServiceRecord.NOAUTHENTICATE_NOENCRYPT, false);
// url = "btspp://001203280265:1;authenticate=false;encrypt=false;master=false";
StreamConnection conn = (StreamConnection) Connector.open(url);

The exception being the following:

javax.bluetooth.BluetoothConnectionException: Failed to connect; [10051] Ein Socketvorgang bezog sich auf ein nicht verfügbares Netzwerk.
// translation: A socket operation was attempted to an unreachable network. This usually means the local software knows no route to reach the remote host.
at com.intel.bluetooth.BluetoothStackMicrosoft.connect(Native Method)
at com.intel.bluetooth.BluetoothStackMicrosoft.access$700(BluetoothStackMicrosoft.java:44)
at com.intel.bluetooth.BluetoothStackMicrosoft$ConnectThread.run(BluetoothStackMicrosoft.java:651)

I have no idea why this exception is occuring and how I can fix it. (That also is the reason why I don't supply more code - I simply don't know where to look for the error.)

This is running on a Windows 7 64-bit machine with the latest snapshot of Bluecove 2.1.1 (63).

If you have an idea how I can handle this problem, I would highly appreciate any helpful comments and answers!

ketza
  • 127
  • 1
  • 12
  • Can u put the `exception` in `English` language ? – AB Bolim Apr 15 '13 at 13:17
  • Here's the translation: "A socket operation was attempted to an unreachable network." I also edited my question. – ketza Apr 15 '13 at 13:29
  • Try to run a [netstat](http://pcsupport.about.com/od/commandlinereference/p/netstat-command.htm) to find out whehter server socket is listening at that port or not. – AB Bolim Apr 15 '13 at 13:46
  • I messed around a little bit with netstat but I don't get it. So you are saying that there should be an entry with a TCP/UDP port relating to my bluetooth connection? I don't even know what port I should look for. If you could give me a hint, that would be great. – ketza Apr 15 '13 at 23:09

0 Answers0