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

Hi there inmates, I've got a problem with an FTP between a Windows server & a UNIX server. I wrote a module a couple of years back that does all our FTP's between UNIX servers and runs without issue. We've now moved one of our servers onto a Windows platform and I've loaded Perl onto this server and amended the code - the direction of the solidi in directory names was about the only change made. When I now initiate an FTP from the Windows server there are 3 files to be transferred. The first file gets transferred and then the script stops/disappears. Once a file has been transferred there is a return value sent to the initiating server. I'm sure that this return value is not being returned to the script - I put in a print after the FTP and before the return value is inspected and we never see it! Is this a known problem? Does anyone know how to get round this?

Replies are listed 'Best First'.
Re: Can return be used between platforms
by moritz (Cardinal) on Jul 03, 2008 at 13:59 UTC
    FTP is a protocol, and as such mostly platform agnostic when done right. The status codes shouldn't be platform dependent. If you want to be sure, use a tool such as tcpdump to monitor your traffic, and compare the FTP traffic between hosts where it works and where it fails.
    The first file gets transferred and then the script stops/disappears.

    What does that mean? does it terminate? If yes, what's the exit code? is there an error message?

    Is suspect it's a programming error on your side, but without seeing the code I can't be sure.

      The script I wrote for UNIX uses Net::FTP and still works to this day on all of our UNIX platforms. When converted for Windows the script, as expected, finds 3 files for transfer. After the first file has been transferred there is no response from the target server and the script just seems to terminate/disappear at this point. Obviously after transferring a file a check is performed on the returnval variable to see if it worked. I have placed a print of the returnval immediately after the FTP and before the returnval is tested. This print is not actioned leading me to believe that the returnval is not being returned to the initiating script. I'm guessing that there is some issue with the setup of FTP on the servers rather than there being an issue with my script.
Re: Can return be used between platforms
by Anonymous Monk on Jul 03, 2008 at 14:29 UTC
    What a singularly bad node title! Wouldn't "Return codes with FTP" or "Cross platform FTP question" or something like that have been better? Anyway, your error is right here:

    I wrote a module a couple of years back that does all our FTP's between UNIX servers
    Your node shows that you obviously do not have enough knowledge of the FTP protocol for such a job, so you should use Net::FTP or one of the many modules on CPAN to do the job for you properly.

      Wow, that was harsh.

      Maybe not incorrect -- but harsh.

      --
      Wade
      Thanks for the help it's always gratifying when the intellectual giants notice us little people.
Re: Can return be used between platforms
by rovf (Priest) on Jul 04, 2008 at 08:56 UTC

    Can you do the FTP manually (using some FTP client)? How does it work when you use Net::FTP?

    There *are* variations in doing FTP, depending on how the server was configured. For example, you can do FTP in active or passive mode. I remember having been in a project where I had to use active mode with some servers to get it running.

    -- 
    Ronald Fischer <ynnor@mm.st>