phpbar.de logo

Mailinglisten-Archive

[php] AW: [php] chatstream

[php] AW: [php] chatstream

Marcel Beerta marcel.beerta_(at)_gmx.net
Tue, 28 Dec 1999 21:24:34 +0100


Hier mal die Funktion, die bei mir läuft:

function ChatStream(){
	$ChatRoom="chatlog.txt";
  ignore_user_abort(1);
  $PingTime=1;
  $Ping=0;
  $lastpos=filesize($ChatRoom);

  while(!connection_aborted()){
    clearstatcache();

    if ($lastpos<filesize($ChatRoom)){
      $fp=fopen($ChatRoom, "r");
      fseek($fp, $lastpos);
      fpassthru($fp);
      $lastpos=filesize($ChatRoom);
    }

    if ($Ping>0)
      $Ping--;
    else {
      $Ping=$PingTime;
      echo " ";
    }
    flush();
    usleep(500000);
  }
  flush();
}



php::bar PHP Wiki   -   Listenarchive