1

I am working on bluetooth communication between two computers. i am using a open source library name 32feet.net. i have dont most of the job. I have made application for two computers to chat with each other. But in order to start communication i need to send connection request from first computer that work as client and from the second computer that work as server, i need to accept the pairing request manually. sending request for pairing is fine. but i dont want to manually accept the request. I want my application accept the request automatically and start communication. is there any way to do this ? and if yes then what do i need to do. I can compromise on security if i have to. thanks in advance

Code for connection acceptance.

public void ServerConnectThread()
        {
            ServerStrted = true;
            updateUI("Server Started. Waiting for Clients !!!");
            BluetoothListener blueListener = new BluetoothListener(mUUID);
            blueListener.Start();
            BluetoothClient conn = blueListener.AcceptBluetoothClient();
            updateUI("Client Has Connected");
            Stream mStream = conn.GetStream();
            while (true)
            {
                try
                {
                    byte[] received = new byte[1024];
                    mStream.Read(received, 0, received.Length);
                    updateUI(Encoding.ASCII.GetString(received));
                    byte[] sent = Encoding.ASCII.GetBytes("Hello Asshole Client");
                    mStream.Write(sent, 0, sent.Length);

                }
                catch(IOException excp)
                {
                    updateUI(excp.Message);
                    MessageBox.Show(`enter code here`excp.Message);
                }
            }
       }
Muhammad Gulfam
  • 225
  • 1
  • 6
  • 19
  • Share the code that listens to the request from the client. As part of the listener you can accept it automatically. If you dont have a a listener, you might need to add one. – Carbine Aug 16 '16 at 11:37

0 Answers0