Help!!

I'm trying to FTP a file up to the web through a Socks5 firewall from within
a Perl script.  I've seen other postings on the web about this, but there
haven't been any answers.  Hopefully someone out there will respond.

I've tried this 2 ways, both with problems:

#1.

##!/usr/bin/perl -w
$|++;

use Net::SOCKS;

# Open the connection.
$sock = undef(); #Clear it first.
my $sock = new Net::SOCKS(socks_addr => '192.168.1.11',
                socks_port => 4080,
                protocol_version => 5);

$f = undef(); #Clear it first.
my $f=$sock->connect(peer_addr=>'ftp.hostname.com', peer_port=>21);
print "connect status: ",
        Net::SOCKS::status_message($sock->param('status_num')), "\n";
if ($sock->param('status_num') == SOCKS_OKAY) {
  print $f ("USER xxxxxxx\n");
  print $f ("PASS *******\n");
  print $f ("CWD /directory\n");
  print $f ("TYPE I\n");
  print $f ('STOR file.txt' . "\n");
  print $f ("QUIT\n");
  while (<$f>) { print }
  $sock->close();
  print "Conection closed";
}

This works for everything EXCEPT the STOR.  (Which is what I'm trying to
do.)  Below is what happens:

connect status: okay
220 hostname.com X2 WS_FTP Server 2.0.0
331 Password required
230-user logged in
230-Welcome to Hostname.
230 user logged in
250 CWD successful
200 Type set to IMAGE.
425 Can't open data connection.
221-Good-Bye
221-Goodbye.
221 Good-Bye
Conection closed

It also will not do the LIST command.  Could someone explain this to me?

2.  I've tried using Net::FTP both with it's proxy support and by attempting
to open a socks connection and FTPing through it, both of which have failed.

If it is possible to FTP through a socks connection, could someone tell me
how?  If not, then could someone tell me how to get the STOR to work in the
example above?

Thanks in advance,
Michael Snead

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to