title: Sending command to a device over Bluetooth by writing to DataOutputStream
body: <p>I'm trying to send a command to a device over my Bluetooth RFCOMM socket Connection.
  -Connection is successful.
  -As soon as it gets connected i tried reading the DataInputStream and i continuously get data from the device.
  -My problem is i'm trying to send a Serial command to the device and on doing that my device doesn't respond to the command.</p>
  
  <p>Is there something wrong in the way i'm sending commands ?  Here is the code i used ...</p>
  
  <pre><code> DataOutputStream Dos = new DataOutputStream(BTsocket.getOutputStream());
   ...........
  
  String message = "SET TIME XXX";
      byte[] msgBuffer = message.getBytes();
      try {
  
          Dos.writeInt(msgBuffer.length);
          Dos.write(msgBuffer); 
          Dos.flush();
  
     } 
     catch (IOException e) {
          Log.e(TAG, "Exception during write.", e);
      }
  </code></pre>