Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: (Kozz) Re: "canned" FTP

by rob_au (Abbot)
on Feb 21, 2002 at 01:15 UTC ( #146676=note: print w/replies, xml ) Need Help??

in reply to (Kozz) Re: "canned" FTP
in thread "canned" FTP

I think you are spot-on with this suggestion Kozz - The problem here seems to relate more to the specifics of the FTP connection and network translation than the program code itself. I have discussed this aspect of FTP transfer previously in some detail in the node Re: Net::FTP Unexpected EOF.

While the node referenced above deals more specifically with the usage of Net::FTP (which I believe would offer a much cleaner and compact solution in this case), PASV behaviour as discussed in the above node can be initiated within a FTP session through the issuing of the command PASV prior to any commands which make use of the ftp-data connection (eg. LIST).

Using the code in question as a base ...

print FTP "PASS password\r\n"; sysread (FTP, $FormData, 1024); print STDOUT "$FormData\n"; print FTP "PASV\r\n"; sysread (FTP, $FormData, 1024);

Just on a final note, you know that by introducing sysread in the manner that you have, you have also introduced some very nasty buffer dependencies in your code - This in itself could cause a number of headaches as your code is moved into production.


perl -e 's&&[@.]/&&s& .com.&_&&&print'

Replies are listed 'Best First'.
Re: Re: (Kozz) Re: "canned" FTP
by PriNet (Scribe) on Feb 21, 2002 at 03:33 UTC
    ok, i have tried a different approach using the PASV approach, but i still get "425 can't build data connection" in the following example... obviously i'm
    print FTP "PASV\r\n"; sysread (FTP, $FormData, 1024); print STDOUT "$FormData\n"; print FTP "LIST\r\n"; sysread (FTP, $FormData, 1024); print STDOUT "$FormData\n"; socket (DATA, AF_INET, SOCK_STREAM, getprotobyname('tcp')); bind (DATA, pack('S n a4 x8', AF_INET, 20, (gethostbyname($FTPdServer) +) [4])); listen (DATA, 1); while (<DATA>) { $FormData = $_; print STDOUT $FormData; } close (DATA); print FTP "QUIT\r\n"; sysread (FTP, $FormData, 1024); print STDOUT "$FormData\n"; close (FTP);
      What happenned to   accept (DATA,IOS)  ?


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://146676]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2018-03-22 08:29 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (273 votes). Check out past polls.