View previous topic :: View next topic |
Author |
Message |
cmxflash -
Joined: 11 Dec 2004 Posts: 872
|
Posted: Sun Aug 28, 2005 2:09 pm Post subject: sleep(x); |
|
|
Well, I just read about the sleep(x); command on PHPs website.
Here's the script I'm using:
Code: | echo "test";
sleep(2);
echo "test"; |
If I run it with the PHP-option "php.exe test.php", it works fine, but if I let Abyss run it, it takes 2 secounds, and then "testtest" get written out. Is it possible to get abyss to write "test" when i enter the page, and then write "test" again after 2 seconds? |
|
Back to top |
|
 |
MonkeyNation -
Joined: 05 Feb 2005 Posts: 921 Location: Cardiff
|
Posted: Sun Aug 28, 2005 7:10 pm Post subject: Re: sleep(x); |
|
|
cmxflash wrote: | Well, I just read about the sleep(x); command on PHPs website.
Here's the script I'm using:
Code: | echo "test";
sleep(2);
echo "test"; |
If I run it with the PHP-option "php.exe test.php", it works fine, but if I let Abyss run it, it takes 2 secounds, and then "testtest" get written out. Is it possible to get abyss to write "test" when i enter the page, and then write "test" again after 2 seconds? |
Its something like it'll only send output after x bytes in buffer or something.
It happens if you run it from the command line too, or should, anyway.
It actually waits 2 seconds, but it buffers the output.
If you make something which reads something large (E.G. Something to parse the Swirve data dump.) it'll load it into buffer as it gets it, but you'll see it come in small waves, as the buffer fills up, and clears. _________________
 |
|
Back to top |
 |
 |
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Mon Aug 29, 2005 12:05 pm Post subject: Re: sleep(x); |
|
|
cmxflash,
PHP buffers your output so you'll have to use flush() and other tricks to force it to send it before the sleep() call. _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
 |
AbyssUnderground -
Joined: 31 Dec 2004 Posts: 3855
|
Posted: Mon Aug 29, 2005 12:23 pm Post subject: |
|
|
Aprelium, could you post a simple example? This functon could help me too but Im not very experienced in php yet... _________________ Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk |
|
Back to top |
|
 |
MonkeyNation -
Joined: 05 Feb 2005 Posts: 921 Location: Cardiff
|
Posted: Mon Aug 29, 2005 2:11 pm Post subject: |
|
|
http://php.net/manual/en/function.flush.php
'Tis pretty self explanitory, just use flush wherever you want to send the currently buffered data. There are other ways, but thats the only one I know of. _________________
 |
|
Back to top |
 |
 |
cmxflash -
Joined: 11 Dec 2004 Posts: 872
|
Posted: Wed Aug 31, 2005 6:16 am Post subject: |
|
|
Example, haven't tested it yet thought:
Code: |
<?
echo "test";
flush();
sleep(2);
echo "\nTest again";
?> |
Oh and btw, PHP does wait if you use the sleep()-function in the command-line.
Edit: Still the same problem.
Edit again: Got it working =)
Code: | <?
echo "test";
flush();
ob_flush();
flush();
sleep(2);
echo "\nTest again";
?> |
|
|
Back to top |
|
 |
MonkeyNation -
Joined: 05 Feb 2005 Posts: 921 Location: Cardiff
|
Posted: Wed Aug 31, 2005 6:50 am Post subject: |
|
|
cmxflash wrote: | Oh and btw, PHP does wait if you use the sleep()-function in the command-line. |
Was talking about buffering. _________________
 |
|
Back to top |
 |
 |
MVXA -
Joined: 01 Jan 2005 Posts: 2
|
Posted: Sat Nov 19, 2005 4:19 am Post subject: |
|
|
The examples do not work on my Server :/. It
seems that the problem is Flush. This Command
will not work. The Buffer flushes always on Script
end and never before. Can anyone help me, please? _________________ I'M HERE |
|
Back to top |
 |
 |
MonkeyNation -
Joined: 05 Feb 2005 Posts: 921 Location: Cardiff
|
Posted: Sat Nov 19, 2005 11:45 am Post subject: |
|
|
MVXA wrote: | The examples do not work on my Server :/. It
seems that the problem is Flush. This Command
will not work. The Buffer flushes always on Script
end and never before. Can anyone help me, please? |
Could you post what you've tried?
Or did you try the exact example above? _________________
 |
|
Back to top |
 |
 |
AbyssUnderground -
Joined: 31 Dec 2004 Posts: 3855
|
Posted: Sat Nov 19, 2005 12:31 pm Post subject: |
|
|
This could be down to the version of PHP you are running. It only works with php5 for me. _________________ Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk |
|
Back to top |
|
 |
MVXA -
Joined: 01 Jan 2005 Posts: 2
|
Posted: Sat Nov 19, 2005 1:37 pm Post subject: |
|
|
Code: | <?php
ob_end_flush();
echo "test";
flush();
sleep(10);
echo "\nTest again";
?> |
This Code works with PHP 4.4.0 now. It seems, that PHP
has 2 Output Buffer. One you can flush with flush() and
one you can flush with ob_flush(). I have deactivated the
ob_* Buffer and now flush() works. :D
Sorry if I wasted your time :/. _________________ I'M HERE |
|
Back to top |
 |
 |
cmxflash -
Joined: 11 Dec 2004 Posts: 872
|
Posted: Sat Nov 19, 2005 6:41 pm Post subject: |
|
|
This topic is a bit old, and I've already figured out how this works. |
|
Back to top |
|
 |
AbyssUnderground -
Joined: 31 Dec 2004 Posts: 3855
|
Posted: Sat Nov 19, 2005 7:10 pm Post subject: |
|
|
If you bothered to read the replies since you asked the question you would see we were helping someone else who had a problem with this script. _________________ Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk |
|
Back to top |
|
 |
cmxflash -
Joined: 11 Dec 2004 Posts: 872
|
Posted: Sat Nov 19, 2005 7:34 pm Post subject: |
|
|
Well, I didn't. I was busy DDoSing P3. |
|
Back to top |
|
 |
MonkeyNation -
Joined: 05 Feb 2005 Posts: 921 Location: Cardiff
|
Posted: Sat Nov 19, 2005 7:35 pm Post subject: |
|
|
cmxflash wrote: | Well, I didn't. I was busy DDoSing P3. |
 _________________
 |
|
Back to top |
 |
 |
AbyssUnderground -
Joined: 31 Dec 2004 Posts: 3855
|
Posted: Sat Nov 19, 2005 7:36 pm Post subject: |
|
|
MonkeyNation wrote: | cmxflash wrote: | Well, I didn't. I was busy DDoSing P3. |
 |
LMAO. He is only DDoSing him because he is using apache and not abyss... _________________ Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk |
|
Back to top |
|
 |
MonkeyNation -
Joined: 05 Feb 2005 Posts: 921 Location: Cardiff
|
Posted: Sat Nov 19, 2005 7:38 pm Post subject: |
|
|
The Inquisitor wrote: | LMAO. He is only DDoSing him because he is using apache and not abyss... |
That doesn't justify it; true or not. _________________
 |
|
Back to top |
 |
 |
AbyssUnderground -
Joined: 31 Dec 2004 Posts: 3855
|
Posted: Sat Nov 19, 2005 7:39 pm Post subject: |
|
|
MonkeyNation wrote: | The Inquisitor wrote: | LMAO. He is only DDoSing him because he is using apache and not abyss... |
That doesn't justify it; true or not. |
Maybe not but at least he told the truth... _________________ Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk |
|
Back to top |
|
 |
cmxflash -
Joined: 11 Dec 2004 Posts: 872
|
Posted: Sat Nov 19, 2005 7:40 pm Post subject: |
|
|
Want me to bring p3net.net down again? |
|
Back to top |
|
 |
AbyssUnderground -
Joined: 31 Dec 2004 Posts: 3855
|
Posted: Sat Nov 19, 2005 7:41 pm Post subject: |
|
|
cmxflash wrote: | Want me to bring p3net.net down again? |
I couldnt care less. _________________ Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk |
|
Back to top |
|
 |
MonkeyNation -
Joined: 05 Feb 2005 Posts: 921 Location: Cardiff
|
Posted: Sat Nov 19, 2005 7:42 pm Post subject: |
|
|
cmxflash wrote: | Want me to bring p3net.net down again? |
 _________________
 |
|
Back to top |
 |
 |
|