title: Android client socket cannot write after flush
body: <p>I can not send data after <code>flush()</code> and without flush it doesn't work...    </p>
  
  <pre><code>package exm.co.me;
  
  import android.app.Activity;
  import android.os.AsyncTask;
  import android.os.Bundle;
  import android.util.Log;
  import android.view.View;
  import android.widget.EditText;
  
  import java.io.BufferedReader;
  import java.io.BufferedWriter;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.io.OutputStreamWriter;
  import java.net.Socket;
  
  public class socket extends Activity {
      Socket socket;
      BufferedReader in=null;
  
      BufferedWriter out;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_socket);
          new backTask().execute();
      }
  
      public void submit(View v){
          EditText m=(EditText)findViewById(R.id.edit_msg);
          String s=m.getText().toString();
          send(s);
      }
  
      public void send(String m){
  
          try{
              out=new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
              out.write(m);
              out.write("\n done.....");
              out.flush();
              Log.d("TcpClient","sent: "+m);
          }catch(IOException e){
              e.printStackTrace();
          }
  
  
      }
      public void setSocket() throws IOException{
          socket=new Socket("192.168.56.1",8080);
          socket.setTcpNoDelay(true);
          in=new BufferedReader(new InputStreamReader(socket.getInputStream()));
          send("connecting......");
          send("connecting 2......");
          new Thread(){
              @Override public void run(){
              int i;
  
              while(true){
                  try{
  
                      String inMsg=in.readLine();
                      Log.i("TcpClient","received: "+inMsg);
                  }catch(IOException e){
                      e.printStackTrace();
                  }
  
               }
              }
          }.start();
          send("connected....");
  
      }
  
      public class backTask extends AsyncTask{
          @Override
          protected Object doInBackground(Object[] params){
              try{
                  setSocket();
              }catch(IOException e){
                  e.printStackTrace();
              }
              return null;
          }
      }
  }
  </code></pre>
  
  <p><code>out.wirte();</code> does not work after flush whay?</p>
  
  <p>I am receiving in server:</p>
  
  <pre><code>connecting....
  done...
  </code></pre>
  
  <p>but not geting:</p>
  
  <pre><code>connectiong 2.... connected...
  </code></pre>
  
  <p>I am using php for server side...</p>
  
  <pre><code>    &lt;?php
  $host = "192.168.56.1";
  $port = 8080;
  $message = "Hello Client";
  set_time_limit(0);
  
  function messege_recived($msg){
  if($msg=="exit"){
  global $socket,$com;
  echo '
  server closed';
  }
  }
  $socket = socket_create(AF_INET, SOCK_STREAM, 0) or die("Could not create socket\n");
  // bind socket to port
  $result = socket_bind($socket, $host, $port) or die("Could not bind to socket\n");
  $result = socket_listen($socket) or die("Could not set up socket listener\n");
  echo 'listining ip '.$host." at port ".$port;
  for($i=0;$i&lt;5;$i++){
  $com = socket_accept($socket) or die("Could not accept incoming connection\n");
  $input = socket_read($com, 1024) or die("Could not read input\n");
  $input = trim($input);
  //message_recived($input);
  echo '
  Client says: '.$input;
  
  //socket_write($com, $message , strlen ($message)) or die("Could not write output\n");
  }
  echo '
  server closed';
  socket_close($com);
  socket_close($socket);
  ?&gt;
  </code></pre>