princepawn has asked for the wisdom of the Perl Monks concerning the following question:

I put a lot in the title to make this post easily searchable by all inquiring posterity. Anyway, the libnetNet::FTP module API has a retr() method that returns a Net::FTP::I object and that class has a read() and write() method. But I did not see a seek() method.

However, the docs for Net::FTP do state that all normal I/O methods can be applied to Net::FTP::dataconn objects and Net::FTP::I does inherit from this class, and even further up the hierarchy is IO::Socket::Inet and even IO::Handle, so logically it should work. But none of these manpages document a seek() method, so I don't feel that partial content is possible using Net::FTP, but I would be overjoyed to be proven wrong.

  • Comment on seek on a data connection returned by Net::FTP? partial content FTP transfer question
  • Download Code

Replies are listed 'Best First'.
Re: seek on a data connection returned by Net::FTP? partial content FTP transfer question
by Albannach (Monsignor) on Apr 25, 2001 at 22:21 UTC
    I think you can get partial content using the offset option of the get method. While you can't seek, you can in this way tell the ftp server to seek for you before sending. Just a thought, as I haven't tested this.

    --
    I'd like to be able to assign to an luser

Re: seek on a data connection returned by Net::FTP? partial content FTP transfer question
by suaveant (Parson) on Apr 25, 2001 at 22:07 UTC
    Umm... since that is a stream, and not a file, I don't think you can seek, though I suppose I could be wrong...

    but how can you seek to the end if the transmission isn't done?
                    - Ant

Re: seek on a data connection returned by Net::FTP? partial content FTP transfer question
by princepawn (Parson) on Apr 25, 2001 at 22:58 UTC
    I looked at the FTP RFC and then went on to a google search. It appears that a RESTART command is optionally part of an FTP server's command set: This link gives more deails on its usage.