Measuring performance of Net::FTP

Discussion in 'Perl' started by Carlo Filippini, Sep 9, 2003.

  1. Hi
    I am trying to measure the perofrmance of a wireless link using
    maily ftp. Unfortunately get and put from Net::FTP do not give me an
    measure of the performances. I am sure somebody must have done this
    already. I just need a DOS like "xxxx bytes transferred in xxx
    seconds", should be quite simple...

    Any suggestion?
    Thanks
    Carlo
     
    Carlo Filippini, Sep 9, 2003
    #1
    1. Advertising

  2. Carlo Filippini

    Philip Guest

    one way to do it is like so (untested):
    -----
    my $file = "foo.txt";
    my $size = -s $file;
    my $done = 0;
    my $time = time();

    my $upload = $ftp->send($file);

    open (FILE, $file);
    while (my $line = <FILE>) {
    my $length = length($line);
    $upload->write($line, $length);
    $done += $length;
    if ($done == $size) {
    $upload->close;
    }
    }
    close;

    my $total = time() - $time;

    print "$done bytes uploaded in $total seconds";

    -----
    downloading would be similar. for example, you would have to get the
    size with $ftp->size(), start the transfer with $ftp->retr(), and get
    data from the buffer with $download->read(), and then print the buffer
    to FILE.
     
    Philip, Sep 9, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    5,683
  2. Vin Raja

    FTP : Time problem (net/ftp)

    Vin Raja, Jun 7, 2007, in forum: Ruby
    Replies:
    0
    Views:
    103
    Vin Raja
    Jun 7, 2007
  3. Ari Brown

    Net::FTP and ftp.dir()

    Ari Brown, Jul 16, 2007, in forum: Ruby
    Replies:
    0
    Views:
    88
    Ari Brown
    Jul 16, 2007
  4. D. Buck
    Replies:
    2
    Views:
    500
    D. Buck
    Jun 29, 2004
  5. Replies:
    2
    Views:
    124
Loading...

Share This Page