title: ANDROID FAILED TO CONNECT BLUETOOTH: read failed, socket might closed or timeout, read ret: -1
body: <p>I'm tyrng to create a connection between my smartphone and my arduino. I'm tryng to create an OutputStream for send int value but I'm receiving this error : <strong><strong><strong>java.io.IOException: read failed, socket might closed or timeout, read ret: -1</strong></strong></strong></p>
  <p>What's wrong with my code? Is and UUID problem? The UUID is 0000110E-0000-1000-8000-00805F9B34FB , I found that on stackoverflow</p>
  <pre><code>    private boolean connectBt() {
      bluetoothAdapter=BluetoothAdapter.getDefaultAdapter();
      bluetoothDevice= bluetoothAdapter.getRemoteDevice(address);
          try {
            socket=bluetoothDevice.createRfcommSocketToServiceRecord(mUUID);
              //socket =(BluetoothSocket) bluetoothDevice.getClass().getMethod(&quot;createRfcommSocketToServiceRecord&quot;, new Class[] {int.class}).invoke(bluetoothDevice,1);
            socket.connect();
              if(socket.isConnected()){
                  try {
                      outputStream=socket.getOutputStream();
                      return true;
                  } catch (IOException e) {
                      Log.e(&quot;bterr&quot;, &quot;ErrORE:&quot; + e.getMessage());
                  }
              }
          } catch (Exception e) {
              Log.e(&quot;bterr&quot;,&quot;Errore:&quot;+e.getMessage());
              Toast.makeText(this, &quot;Err:&quot;+e.getMessage(), Toast.LENGTH_LONG).show();
          }
  return  false;
  }
  </code></pre>
  <p>}</p>