How do I open a stream connection?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kakatwa Amigo
    New Member
    • Feb 2013
    • 3

    How do I open a stream connection?

    Hi...
    my code always fail when it reached
    Code:
     server = (StreamConnectionNotifier)Connector.open(url.toString ());
    it gives an error: java.io.IOExcep tion: Can't create Service [General fail]

    Code:
    System.out.println("Setting device..");
                local = LocalDevice.getLocalDevice();
                            if (!local.setDiscoverable (DiscoveryAgent.GIAC)) {
                     
                     throw new IOException("Can't set discoverable mode...");
                }
                StringBuffer url = new StringBuffer ("btspp://");
                url.append ("localhost").append (':');
                url.append (uuid.toString ());
                url.append (";name=code");
                url.append (";authorize=false");
                System.out.println("Opening URL");            
                try{
                    server = (StreamConnectionNotifier)Connector.open(url.toString ());
                }catch(Exception e){
    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.
Working...