Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

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&&rob@cowsnet.com.au&&&split/[@.]/&&s& .com.&_&&&print'


Comment on Re: (Kozz) Re: "canned" FTP
Select or Download Code
Re: Re: (Kozz) Re: "canned" FTP
by PriNet (Beadle) 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 lost...lol...
    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)  ?

        p

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://146676]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (16)
As of 2014-07-24 17:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (163 votes), past polls