I want to create two applications . one will be for server and other will be multiple Clients .

Purpose : Concurrently communication between server and multiple clients for reading and writing Data.

Unable to communicate for multiple Clients

public class BtAcceptSever extends Thread { BtAcceptSever() { byte[] Readbuffer=new byte[7]; mBluetoothServerSocket = null; mmSocket = null; while (true) { try { Log.d("Connected", "1"); // mBluetoothServerSocket = mBluetoothAdapter.listenUsingRfcommWithServiceRecord("bt6", myUUID); Log.d("Connected", "2"); if(mBluetoothServerSocket!=null) { mmSocket = mBluetoothServerSocket.accept(); Log.d("Connected", "3"); DataInputStream input=new DataInputStream(mmSocket.getInputStream()); while(input.available()>0) {Log.d("BtServer","Reading from Client"); bytesRead=input.read(Readbuffer,0,8); Log.d("Reading from Client",Readbuffer.toString()); Buffer += new String(readBuffer, 0, bytesRead); Log.d("Data Reading Done",Buffer ); }

} } catch (Exception e) { } } } }

More Suneel Dembra's questions See All
Similar questions and discussions