I use the code beneath to register my service, this works fine on a 6680. But when i try to use it on a nokia 6600 the server could not connect to it.
The first message to the server includes the connection string to the service on the client obtained by the following code
ServiceRecord sr = localDevice.getRecord(notifier);
connectionString = sr.getConnectionURL(ServiceRecord.NOAUTHENTICATE_NOENCRYPT, false);
The Server uses this connection string but couldn't connect to the 6600. It gets: java.io.IOException: Failed to connect socket
Registration code:
...
private static final String clientUuid = "3def3def3def3def3def3def3def3de0";
private static final String serviceName = "BlueMusicClient";
...
// install Bluetooth service
String url = "btspp://localhost:" + clientUuid + ";name=" + serviceName;
try {
notifier = (StreamConnectionNotifier) Connector.open(url);
} catch (IOException e) {
// TODO ERROR Handling
e.printStackTrace();
}
StreamConnection con = null;
acceptConnections = true;
ByteArrayOutputStream message = new ByteArrayOutputStream();
InputStream is;
int b;
while (acceptConnections) {
try {
// block until client connects
con = notifier.acceptAndOpen();
is = con.openInputStream();
message = new ByteArrayOutputStream();
while ((b = is.read()) != -1) {
message.write(b);
}
is.close();
con.close();
} catch (IOException e) {
// TODO error handling
}
}
}
Any help highly appreciated
woodi

Reply With Quote

