Results 1 to 1 of 1
  1. #1
    lambi is offline Member
    Join Date
    Dec 2009
    Rep Power

    Default Disabling Bluetooth passkey

    Tbh, i'm not even sure if this is a Java or more of a windows problem, but since i'm coding in Java, i might as well ask here, maybe someone can help me...

    I'm building a bluetooth-server, that's supposed to initialize the bluetooth device, register a service and then wait for incoming connections. When a client connects, the server should start a simple file transfer. The Server itself seems to be running fine (code see below), but unfortunately, i can't establish any connections. When i try to connect with a second device, both that device and the comp running the server are asked to enter a passkey. But, as servers go, this one's supposed to run unattended, so no passkey is entered on the server-side, resulting in a failed connection attempt. Is there a way of disabling the need for a passkey on the server-side (or set one up via the code that would be applicable for all connection attempts)?

    (site note: also, even after entering a passkey on both sides, the server sees no connection, but i assume that's somehow tied to my main problem).

    using WinXP and the BlueCove implementation of the BT stack.
    Java Code:
    import javax.bluetooth.*;
    public class FileServer {
        private void startServer() throws IOException {
            System.out.println("Server started, waiting for connections...");
            //Name of Service
            String myServiceName = "ClientDistributor";
            //UUID of Service
            String myServiceUUID = "CB230ADBD1AE4bf495195C59525BC659";
            UUID MYSERVICEUUID_UUID = new UUID(myServiceUUID, false);
            //Server URI
            String connURL = "btspp://localhost:"+MYSERVICEUUID_UUID.toString()+";"+"name="+myServiceName+";authenticate=false;encrypt=false;";
            //create connection
            StreamConnectionNotifier scn = (StreamConnectionNotifier);
            //open connection, insert service into sddb and wait for clients
            StreamConnection sc = scn.acceptAndOpen();
            //client connected, get handle
            RemoteDevice rd = RemoteDevice.getRemoteDevice(scn);
            System.out.println("New client connection... " + rd.getFriendlyName(false));
        public static void main(String[] args) throws IOException {
            //get local device
            //display local device address and name
            LocalDevice localDevice = LocalDevice.getLocalDevice();
            System.out.println("Address: " + localDevice.getBluetoothAddress());
            System.out.println("Name: " + localDevice.getFriendlyName());
            //set discoverable
            //Clients retrieve the discovery agent
            DiscoveryAgent discoveryAgent = localDevice.getDiscoveryAgent();
            FileServer fileServer = new FileServer();
    Last edited by lambi; 12-29-2009 at 03:05 PM.

Similar Threads

  1. [SOLVED] Disabling Inherited Methods
    By Singing Boyo in forum New To Java
    Replies: 7
    Last Post: 05-17-2009, 07:04 AM
  2. Disabling a button at EOF
    By dbashby in forum New To Java
    Replies: 1
    Last Post: 03-10-2009, 02:37 PM
  3. Replies: 0
    Last Post: 02-26-2009, 08:14 PM
  4. Disabling part of a method
    By juru in forum Advanced Java
    Replies: 10
    Last Post: 10-27-2008, 01:41 AM
  5. disabling JButtons after win in TicTacToe
    By noisepoet in forum New To Java
    Replies: 1
    Last Post: 05-18-2007, 11:01 PM

Posting Permissions

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