Sign in to follow this  
Followers 0
andybiochem

Download manager / Limit speed

5 posts in this topic

Hi everyone,

Just wondering if this sort of thing can be done within autoit, or if it needs lower level programming.

My ISP (tiscali UK) has a "Fair-use" policy for their broadband service; pretty much you can download any ammount of data, but not between the hours of 18:00 - 23:00, as this is considered to be the 'peak time'.

So what I want to do is write a program that allows full connection outside of these hours, but then totally throttles the connection at 18:00 so nothing can be downloaded, and then un-throttle at 23:00 unleashing the full 8Mb/s.

I want to maintain a connection at all times (although I might conceed to automating a disconnect - reconnect if it can't be done).

Thanks in advance for any advice!!!


- Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar!

Share this post


Link to post
Share on other sites

Thanks for the link! So it is possible to monitor the current speed of a download, cool.

Now just need to know how to control that speed. :)

I've found this example written in PHP that does the job:-

// local file that should be send to the client
$local_file = 'test-file.zip';
// filename that the user gets as default
$download_file = 'your-download-name.zip';
 
// set the download rate limit (=> 20,5 kb/s)
$download_rate = 20.5; 
if(file_exists($local_file) && is_file($local_file)) {
    // send headers
    header('Cache-control: private');
    header('Content-Type: application/octet-stream'); 
    header('Content-Length: '.filesize($local_file));
    header('Content-Disposition: filename='.$download_file);
 
    // flush content
    flush();    
    // open file stream
    $file = fopen($local_file, "r");    
    while(!feof($file)) {
 
        // send the current file part to the browser
        print fread($file, round($download_rate * 1024));   
 
        // flush the content to the browser
        flush();
 
        // sleep one second
        sleep(1);   
    }   
 
    // close file stream
    fclose($file);}
else {
    die('Error: The file '.$local_file.' does not exist!');
}

This uses the PHP "fread" to quote: "fread() reads up to length bytes from the file pointer"

So, put up a handle to the file, and read x bytes. Depending on the size of the file and looping every second, you can control the effective download rate.

Is there any way to emulate to fread in autoit - maybe using InetGet?

something like: InetGet([certain portion of file to D/L])

Just some pointers will do, no need to code-up anything!!

Otherwise, if it can't be done, I've found Net Limiter (http://www.netlimiter.com/index.php) which has a 'scheduler' so you can tell it to limit your connection at certain times. Looks good and only 30$ (15 quid).


- Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar!

Share this post


Link to post
Share on other sites

Similar post here- http://www.autoitscript.com/forum/index.php?showtopic=49465

The problem with the PHP script is it running under a web-based context from the server, whilest autoit in more of a client side thing, so you'd be looking at how to limit your download from the client side rather than limitng your upload from the server side. If you wrote your own file transfer script you could do this easily though by limiting the about of data you send with TCPSend().

Share this post


Link to post
Share on other sites

Similar post here- http://www.autoitscript.com/forum/index.php?showtopic=49465

The problem with the PHP script is it running under a web-based context from the server, whilest autoit in more of a client side thing, so you'd be looking at how to limit your download from the client side rather than limitng your upload from the server side. If you wrote your own file transfer script you could do this easily though by limiting the about of data you send with TCPSend().

ooooh, TCPSend()....I hadn't seen the TCP autoit functions, I'll look into that - cheers! :)

I can feel a vertical learning-curve approaching though!!!! :)


- Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0