aspose file tools*
The moose likes Java Micro Edition and the fly likes bluetooth connction blocks file creation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "bluetooth connction blocks file creation" Watch "bluetooth connction blocks file creation" New topic
Author

bluetooth connction blocks file creation

Ritesh Chopade
Greenhorn

Joined: Oct 22, 2008
Posts: 8
In my application, I have to establish the connection to server mobile(slave) through bluetooth. but once I establish connection to server mobile, I am unable to create new file.
But the file is created before connection establishment. I have set all API permissions also.
If anyone have solution, please help me its too urgent.
HaoZhe Xu
Ranch Hand

Joined: Nov 03, 2003
Posts: 222
You should explain more clearer:

1 Do you use only one thread for everything? If so, and after you connect to server and waiting for IO, that blocks the thread so you won't be able to create a new file

2 Do you mean RMS data or local file via JSR 75 File Connection API?

3 What error message/exception do you get? Can you try to catch some exceptions and post the results?


[url]Olnex.net[/url]
[SCJP 1.2, SCJD, SCWCD]
Ritesh Chopade
Greenhorn

Joined: Oct 22, 2008
Posts: 8
Hi HaoZhe,
I use different thread for bluetooth connection & file creation.
And I am talking about local file via JSR 75 File Connection API.
I never get any error/exception.

The following is the code fragment of my application. The code works fine event the exists method of File Connection class return true
(i.e:- file created), but I am unable to find it at file system.

The code fragment as,

final byte[] data = "It is my just a test data".getBytes(); //It is the data which is comes from another bluetooth device
final String fName = "file:///root1/test.txt"; //The file I want to create at my file system(i.e:- root1 folder in my file system)
new Thread(new Runnable() {

public void run() {
try{
FileConnection fc = (FileConnection) Connector.open(fName, Connector.WRITE);
System.out.println("fc.exists()(Before) : " + fc.exists() ); //It prints "fc.exists()(Before) : false"
if( !fc.exists() ){
fc.create();
System.out.println("fc.exists()(After) : " + fc.exists() ); //It prints "fc.exists()(After) : true"
OutputStream fout = fc.openOutputStream();
fout.write(data);
fout.close();
}
fc.close();
}catch(IOException ex){
ex.printStackTrace();
}
}
}).start()


And for more information you check my yesterday's post Unable to create file
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: bluetooth connction blocks file creation
 
Similar Threads
Remote PC file access on a mobile
client-server via bluetooth serial port
transfer file withour asking the passcode
Bluetooth kick start
Connecting two mobiles through socket connection