Trouble to send text with bluetooth

[email protected] Fri, 25 Jul 2008 01:38:32 PDT
Newsgroups gmane.comp.java.sun.kvm
Message-ID <12106435.173271216975145476.JavaMail.tomcat@sdcst12.sjc.collab.net>
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 [b]clientSession.connect(null)[/b]

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
[Message sent by forum member 'arald' (arald)]

http://forums.java.net/jive/thread.jspa?messageID=289270

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff KVM-INTEREST".  For general help, send email to
[email protected] and include in the body of the message "help".