×

Discussion Board

Results 1 to 1 of 1
  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    23

    Problem with SPP and InputStream. Problem 2 how to get around authentication

    Hello

    I'm having a problem with a 6230i (haven't tested it with different nokias yet) and a PC-Mobile spp connection using bluecove.
    My program works well with motorola and sony ericsson devices.
    I build on the spp example (BTGallery) from benhuis site.


    I receive a msg from the PC, send back an answer (which works) and then I get:
    input stream already opened

    Well well, a bit of a surprise that this natel is the only one having that problem. Here the code I used on both, PC and mobile


    public void send(String s) {
    try {

    DataOutputStream out = c.openDataOutputStream();
    out.writeUTF(s);
    print("writing: '" + s + "'");
    out.flush();
    Thread.sleep(1000);

    out.close();
    Thread.sleep(1000);
    } catch (Exception e) {
    print("send error in spp server "+e.getMessage());
    e.printStackTrace();
    }
    }

    public String receive() {
    String s = null;
    try {

    // obtain an input stream to the remote service
    DataInputStream in = c.openDataInputStream();

    // read in a string from the string
    s = in.readUTF();
    print("reading: '" + s + "'");
    Thread.sleep(1000);
    in.close();
    Thread.sleep(1000);
    } catch (Exception e) {
    print("receive error in spp server "+e.getMessage());
    e.printStackTrace();
    }
    return s;
    }


    there's too a function for image receiving:

    private byte[] receiveImage(int numberOfBytes) {

    byte[] b = new byte[numberOfBytes];
    try {
    DataInputStream in = c.openDataInputStream();
    in.readFully(b);
    in.close();
    Thread.sleep(1000);
    } catch (Exception e) {
    e.printStackTrace();
    }

    return b;
    }

    --------------------------------------------


    A different question is the authentication
    If i use for example

    btspp://0013fd9c52aa:25;authenticate=false;encrypt=false

    as service URL I still have to authenticate with passkey to enable the bt transfer. Is there a way to get around this or to automate it on the PC side?


    thanks


    Jossi
    Last edited by Jossnaz; 2006-09-24 at 14:03.

Similar Threads

  1. 7610 SPP inputstream close after a single read()
    By aluckybird in forum Bluetooth Technology
    Replies: 2
    Last Post: 2004-12-28, 13:25

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •