title: Strange behavior of socket outputstream android
body: <p>I wrote an <code>android</code> app which connect to <code>ServerSocket</code> (that written in <code>Java</code>) and supposed to transfer some data in parallel.
  I have 3 socket - one for text transfer and two for data transfer(sound, images etc..)
  everything works fine in the first hours, but after that the <code>write()</code> method get stuck and doesn't transfer any data, and after about 15 minutes I get <code>sendto failed: ETIMEDOUT (Connection timed out)</code> exception.
  The strange thing is that the text do get transferred anytime..<br>
  I am using <code>DataOutputStream</code> to transfer the text and <code>BufferedOutputStrem</code> to transfer the data..
  The base code is simple:</p>
  
  <pre><code>    while((max=fis.read(b))!=-1){
         dataOut.write(b, 0, max);
         dataOut.flush();
      }
     fis.close();
  </code></pre>
  
  <p>and in the server:</p>
  
  <pre><code>while(counter&lt;size){        
      max = dataStream.read(b);
      fos.write(b, 0, max);
      counter = counter + max;
  }
  fos.close();
  </code></pre>
  
  <p><strong>Edit:
  Ok I finally found out the problem..
  It looks like that socket which not send some data for a long time will not work properly.
  so I will have to send one byte every X minutes..</strong></p>