Hi,
I have a trouble: I want to send text from my laptop to Nokia N95 using bluetooth tecnology.
This is my source:
ClientSession clientSession = (ClientSession) Connector.open(serverURL);
[b]HeaderSet hsConnectReply = clientSession.connect(null);[/b]
if (hsConnectReply.getResponseCode() != ResponseCodes.OBEX_HTTP_OK) {
System.out.println("Failed to connect");
return;
}
HeaderSet hsOperation = clientSession.createHeaderSet();
hsOperation.setHeader(HeaderSet.NAME, "Hello.txt");
hsOperation.setHeader(HeaderSet.TYPE, "text");
//Create PUT Operation
Operation putOperation = clientSession.put(hsOperation);
// Send some text to server
byte data[] = "Hello world!".getBytes("iso-8859-1");
OutputStream os = putOperation.openOutputStream();
os.write(data);
os.close();
putOperation.close();
clientSession.disconnect(null);
clientSession.close();
The application crashes at clientSession.connect(null)
The program open the connection, device show me the dialog view to accept the bluetooth connection but if I accept the application stops. No error are been notified but the program wait for something and it doesn't go on.
Any idea?
Thanks