Hi,
I am trying to connect to a server in order to receive a file from the 
server.. with the help of bluetooth..
*The code is as shown below:*

private void connectServer() {
if(mBluetoothAdapter.isEnabled()){
  try{
  boolean startDiscovery = mBluetoothAdapter.startDiscovery();
  if(true == startDiscovery ){
device = 
BluetoothAdapter.getDefaultAdapter().getRemoteDevice(SERVER_MAC_ID);
Method m = device.getClass().getMethod("createRfcommSocket", new Class[] { 
int.class });
btSocket = (BluetoothSocket) m.invoke(device,Integer.valueOf(1));
mBluetoothAdapter.cancelDiscovery();
 btSocket.connect();
Toast.makeText(this,"Connected,Waiting to Receive 
Files...",Toast.LENGTH_LONG).show();
  } 
  }catch(Exception ex){
  Toast.makeText(this,"Connection 
Error:"+ex.getLocalizedMessage(),Toast.LENGTH_LONG).show();
  }finally{
try {
btSocket.close();
}catch (IOException e) {
Toast.makeText(this,"Connection Error:" + 
e.getLocalizedMessage(),Toast.LENGTH_LONG).show();
}
  }
}
}

I am getting the following exception at the highlighted line..
*java.io.IOException: [JSR82] connect: Connection is not created (failed or 
aborted).*
*
*
What is the mistake that i am doing...Any help in this regard will be 
appreciated.
Regards,
AnandaKrishna S

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to