sub open_remote { my $self = shift; my $continue = 1; my $ftp = new IO::Socket::INET(Proto => "tcp", PeerAddr => $self->{HOST}, PeerPort => 21, Timeout => 60, Reuse => 1); if (!$ftp) { $continue = 0; print "Failed to new control socket\n" if ($self->{DEBUG}); } if ($continue) { my $response = <$ftp>; print $response if ($self->{DEBUG}); $continue = 0 if ($response !~ /^220/); } if ($continue) { print $ftp "USER $self->{USER}\r\n"; my $response = <$ftp>; print $response if ($self->{DEBUG}); $continue = 0 if ($response !~ /^331/); } if ($continue) { print $ftp "PASS $self->{PASSWD}\r\n"; my $response = <$ftp>; print $response if ($self->{DEBUG}); $continue = 0 if ($response !~ /^230/); } if ($continue) { print $ftp "CWD $self->{DIRECTORY}\r\n"; my $response = <$ftp>; print $response if ($self->{DEBUG}); $continue = 0 if ($response !~ /^250/); } my $data_l; my $data; if ($continue) { $data_l = new IO::Socket::INET(Proto => "tcp", LocalPort => $ftp->sockport(), Listen => 1, Timeout => 60, Reuse => 1); if (!$data_l) { $continue = 0; print "Failed to new data socket\n" if ($self->{DEBUG}); } } if ($continue) { print $ftp "RETR $self->{FILE}\r\n"; $data = $data_l->accept(); close($data_l); if (!$data) { print "failed to accept data connection\n" if ($self->{DEB +UG}); $continue = 0; } else { my $response = <$ftp>; print $response if ($self->{DEBUG}); @{$self->{DATA}} = <$data>; close($data); $response = <$ftp>; print $response if ($self->{DEBUG}); } } if ($ftp) { print $ftp "QUIT\r\n"; my $response = <$ftp>; print $response if ($self->{DEBUG}); close($ftp); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: ftp, and store file in memory instead of persist to disk
by staunch (Pilgrim) on Feb 19, 2003 at 16:56 UTC | |
|
•Re: ftp, and store file in memory instead of persist to disk
by merlyn (Sage) on Feb 19, 2003 at 16:09 UTC | |
by pg (Canon) on Feb 19, 2003 at 16:45 UTC | |
by merlyn (Sage) on Feb 19, 2003 at 16:52 UTC | |
| |
|
Re: ftp, and store file in memory instead of persist to disk
by steves (Curate) on Feb 20, 2003 at 03:42 UTC |