in reply to Re: Aborting ftp
in thread Aborting ftp

I am a "newbie" too. But please confirm this:
1) You don't need multiple processes downloading multiple files at the same time - correct? If you don't need to download multiple files at once, this is a huge simplification!
2) It sounds like you run a program in a window and it becomes "stuck"? - e.g. you see no return prompt and it looks like the program hangs?
Is that what is going on?
3) If the above is correct, can you back up one step and tell me more about what you are trying to accomplish?

Replies are listed 'Best First'.
Re^3: Aborting ftp
by intrance (Initiate) on Dec 30, 2008 at 16:12 UTC

    Your assumptions are correct. I try to make an ftp client with NET::FTP. It's not that I have no prompt, The execution stucks on $ftp->get(). I just want to do other staff. I don't want to waste your time, I just want to know if I did something wrong or if it's just the case with get(). I thought that forking would allow me to read from STDIN. Thanks for your time so far.

      I think that the first reply to your post was on target. I have looked at the Net::FTP doc's and this appears to be "spot on". I suspect that your problem is at a much higher level than just getting the file. First, you have to authenticate and get logged-on. Follow the steps below.
      use Net::FTP; $ftp = Net::FTP->new("some.host.name", Debug => 1) or die "Cannot connect to some.host.name: $@"; $ftp->login("your_name",'password') or die "Cannot login ", $ftp->message; $ftp->cwd("remote_dir") #cwd at remote site may not #be necessary depending upon your logon. or die "Cannot change working directory ", $ftp->message; $ftp->get("somefilename") or die "get failed ", $ftp->message;
      Wish you well...

        Thank you so much for everything Marshall.I did all these. I will try to solve this later. If I find something I'll let you know. Have a wonderfull year

      Hi, I've been busy with things other than software for the past couple of days.

      I don't know what OS you have, but fork() on Windows is a mess! This doesn't work like on *NIX and is not transportable code.

      I would suggest getting this working from the command line first. "prompt> ftp -h" will display some not so helpful "help". Other ways: most browsers(IE,Firefox, etc) allow FTP://..someurl.. Also, I use WinSCP (a Windows program) for a lot of transfers to secure sites. This is freeware.

      Maybe you don't even need a Perl program at all?