Hmm that apache module isn't quite what I need, it just accepts or refuse connections based on bandwidth usage, it does not throttle the connection.

----- Original Message ----- From: "Rangel Reale" <[EMAIL PROTECTED]>
To: "Ovidiu Rosoiu" <[EMAIL PROTECTED]>
Cc: <php-general@lists.php.net>
Sent: Thursday, May 17, 2007 6:10 PM
Subject: Re: [PHP] Download speed limit


Yes, it seems to be bad thing, but this limit is because the big files are
non-critical, but I can't let them hammer the customer's connection, using
all the bandwidth. The internet connection is slow (500kbps ADSL), and they
have the critical applications running on it. It is no problem my download
taking 5 hours, event if the connection is broken I can continue the
download after.

I will look at the link you posted, thanks! But if there is a php solution
for this, that would be better for my application.

----- Original Message ----- From: "Ovidiu Rosoiu" <[EMAIL PROTECTED]>
To: "Rangel Reale" <[EMAIL PROTECTED]>
Cc: <php-general@lists.php.net>
Sent: Friday, May 18, 2007 2:34 PM
Subject: Re: [PHP] Download speed limit


limiting speed by using sleep in your script is a very bad idea. for a 350
MB file, with a 20 KB/s limit the script would take aprox. 5 hours. you
can see how this is totally wrong. even skyrocketing the timeout, it's not
a good solution.
Use a web server mod for dynamic bandwidth limiting. See
http://www.topology.org/src/bwshare/README.html, maybe it will help you.

Rangel Reale wrote:
Between 90 and 350 MB.

----- Original Message ----- From: "Jim Lucas" <[EMAIL PROTECTED]>
To: "Rangel Reale" <[EMAIL PROTECTED]>
Cc: <php-general@lists.php.net>
Sent: Wednesday, May 16, 2007 6:41 PM
Subject: Re: [PHP] Download speed limit


Rangel Reale wrote:
Hello!

For my application I need to limit the speed that my application sends
data, in my case a binary file.

I need to send the speed as a parameter, like:

sendfile.php?speed=20000

Would send the file at 20kb/s (forgetting about real byte counts for
this example).

To send the file, I am doing:

    $fp=fopen($this->contentfile,"rb");
    while(!feof($fp)){
        print(fread($fp,1024*8));
        flush();
        ob_flush();
    }
    fclose($fp);

If after ob_flush I do a sleep(), I can limit the speed, but I would
like to limit at the speed of the parameter.

Is there a way to do this?

Thanks,
Rangel

on average, how big are the files that you will be sending?

--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Unknown

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
No virus found in this incoming message.
Checked by AVG Free Edition. Version: 7.5.467 / Virus Database:
269.7.0/803 - Release Date: 13/5/2007 12:17







--
No virus found in this incoming message.
Checked by AVG Free Edition. Version: 7.5.467 / Virus Database:
269.7.0/803 - Release Date: 13/5/2007 12:17




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to