By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,654 Members | 1,519 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,654 IT Pros & Developers. It's quick & easy.

How do I open a stream connection?

P: 3
Hi...
my code always fail when it reached
Expand|Select|Wrap|Line Numbers
  1.  server = (StreamConnectionNotifier)Connector.open(url.toString ());
it gives an error: java.io.IOException: Can't create Service [General fail]

Expand|Select|Wrap|Line Numbers
  1. System.out.println("Setting device..");
  2.             local = LocalDevice.getLocalDevice();
  3.                         if (!local.setDiscoverable (DiscoveryAgent.GIAC)) {
  4.  
  5.                  throw new IOException("Can't set discoverable mode...");
  6.             }
  7.             StringBuffer url = new StringBuffer ("btspp://");
  8.             url.append ("localhost").append (':');
  9.             url.append (uuid.toString ());
  10.             url.append (";name=code");
  11.             url.append (";authorize=false");
  12.             System.out.println("Opening URL");            
  13.             try{
  14.                 server = (StreamConnectionNotifier)Connector.open(url.toString ());
  15.             }catch(Exception e){
  16.  
I don't know how to make a service in a case like this when I'm setting my device in setDiscoverable...
I would appreciate some explanations and sample.
Feb 14 '13 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.