title: Android Bluetooth sending file problem
body: <p>I am writing a small program to send file between Android and PC through bluetooth. I already 
  read the bluetooth chat example in google android site.</p>
  
  <p>Currently, my version works really well with sending a text message via bluetooth, but when I send some files, around >= 20 KB, it stops working and throwing EOFException as below:</p>
  
  <pre><code>java.io.EOFException at java.io.ObjectInputStream$BlockDataInputStream.readFully(ObjectInputStream.java:2716)
      at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1665)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1340)
      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1963)
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1887)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1770)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1346)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:368)
      at com.test.pcserver.BluetoothServerListener.run(BluetoothServerListener.java:74)
      at java.lang.Thread.run(Thread.java:636)
  </code></pre>
  
  <p>Currently, my java program on the PC using <code>bluecove-2.1.0</code></p>
  
  <p>Here are my main codes:</p>
  
  <p>In Android:</p>
  
  <pre><code>// Get the BLuetoothDevice object
  if (BluetoothAdapter.checkBluetoothAddress(address)) {
      device = mBtAdapter.getRemoteDevice(address);
  
          // Get a BluetoothSocket for a connection with the
      // given BluetoothDevice
      socket = device .createRfcommSocketToServiceRecord(ProgramConstants.BLUETOOTH_UUID);
      socket.connect();
  
          out = new ObjectOutputStream(socket.getOutputStream());
  
      // Send it to PC
      out.writeObject(contentObject);
      out.flush();        
  }
  </code></pre>
  
  <p>In My PC, I read it:</p>
  
  <p>PC Version, server</p>
  
  <pre><code>StreamConnectionNotifier streamConnNotifier = null;
  
  // Create the service url
  String connectionString = "btspp://localhost:" + ProgramConstants.BLUETOOTH_UUID.toString()
                      + ";name=myappname";
  // open server url
  streamConnNotifier = (StreamConnectionNotifier) Connector.open(connectionString);
  
  while (true) {
    // Wait for client connection
    StreamConnection connection = streamConnNotifier.acceptAndOpen();
    ObjectInputStream in = new ObjectInputStream(connection.openInputStream());
    RemoteDevice dev = RemoteDevice.getRemoteDevice(connection);
  
    // read string from spp client
    DataInController data = new DataInController(model);
    data.processDataIn(in.readObject(), dev.getBluetoothAddress());   
  }
  </code></pre>