How can i send 'eof' to the client?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • S. C. Jeong

    How can i send 'eof' to the client?

    I want to send 'eof' kind of message after some processes. Die or exit
    cannot be used because there are some more processes to complete, but
    nothing major to users.

    <?php
    phpinfo ();
    //i want to finish the process here!!
    //flush () //? doesnt work?
    sleep (10); // mimic of (not)complicate d process
    ?

    Help me to solve this problem :)

    Calvin J

  • Bent Stigsen

    #2
    Re: How can i send 'eof' to the client?

    S. C. Jeong wrote:[color=blue]
    > I want to send 'eof' kind of message after some processes. Die or exit
    > cannot be used because there are some more processes to complete, but
    > nothing major to users.
    >
    > <?php
    > phpinfo ();
    > //i want to finish the process here!!
    > //flush () //? doesnt work?
    > sleep (10); // mimic of (not)complicate d process
    > ?[/color]

    There might be many reasons why it doesn't work, as mentioned in the
    manual along with hints of what to do.


    Depending on how it is supposed to work, you might want to use
    "ignore_user_ab ort", in case the user decides to go somewhere else
    before your subsequent process finishes.


    /Bent

    Comment

    • Chung Leong

      #3
      Re: How can i send 'eof' to the client?


      S. C. Jeong wrote:[color=blue]
      > I want to send 'eof' kind of message after some processes. Die or exit
      > cannot be used because there are some more processes to complete, but
      > nothing major to users.
      >
      > <?php
      > phpinfo ();
      > //i want to finish the process here!!
      > //flush () //? doesnt work?
      > sleep (10); // mimic of (not)complicate d process
      > ?
      >
      > Help me to solve this problem :)
      >
      > Calvin J[/color]

      Try turning on output buffering and setting the Content-Length header
      before sending the contents.

      <?

      ob_start();
      /* ... do stuff ... */
      $s = ob_get_clean();
      $len = strlen($s);
      header("Content-Length: $len");
      echo $s;

      ?>

      Might want to set the Connection header to 'closed' as well.

      Comment

      Working...