url = "btspp://localhost:"+macaddress;
System.out.println("Setting device to be discoverable...");
local = LocalDevice.getLocalDevice();
local.setDiscoverable(DiscoveryAgent.GIAC);
System.out.println("Start advertising service...");
server = (StreamConnectionNotifier)Connector.open(url);
System.out.println("Waiting for incoming connection...");
con = (StreamConnection) server.acceptAndOpen();
after this, if i close the server (acceptandopen) because i need to send something to the same device, i get an error on line 2
CODE
1 url = "btspp://"+macaddress+":5";
2 con = (StreamConnection) Connector.open(url);
ERROR
java.io.IOException: Failed to connect. [115] Operation now in progress
at com.intel.bluetooth.BluetoothStackBlueZ.connectionRfOpenClientConnectionImpl(Native Method)
Why?
Thank you at all.