title: How to determine socket resource has completed buffering?
body: <p>Firing a command to socket resource and getting the output takes some decent amount of time in PHP.</p>
  
  <p>I have written code to read the buffered output string after sleep duration of 1 second and it works fine.
  If i don't provide any delay after fputs, i don't get any string.</p>
  
  <p>How to determine this time? putting time duration by hit and trial can cause trouble.
  For safe side i always put time in seconds.  </p>
  
  <p>What parameters affect this time, does anyone has statistical data?</p>
  
  <pre><code>$socket = fsockopen($ip,3083);
  $command = 'RTRV-NE-GEN:::123;';
  fputs($socket,$command);
  sleep(1);
  $string = fread( $socket, 3000 );
  </code></pre>