amcleod has asked for the wisdom of the Perl Monks concerning the following question:
My perl script however does not. It appears to connect OK but won't allow any of the methods from the module to succeed.
The output from running this is as follows:#!/usr/bin/perl -w use feature 'say'; use Net::FTP; $ftp = Net::FTP->new( Host => 'my.host.name', Port => 2221, Debug => 1, Passive=>0 ) or die "Can't connect to server: $@"; say "Connected OK"; $ftp->binary or die "Can't switch to binary mode: $@"; say "Switched to binary mode"; $where = $ftp->pwd() or die "Can't get working directory: $@"; say "\$working directory = $where"; @ls = $ftp->ls() or die "Can't get directory listing: $@"; say "Entries found = ". scalar @ls; $ftp->close();
The connection appears to be good, but any of the commands I try generate a 530 Access denied. error. This happens no matter which server I activate on the phone.Net::FTP>>> Net::FTP(3.11) Net::FTP>>> Exporter(5.73) Net::FTP>>> Net::Cmd(3.11) Net::FTP>>> IO::Socket::SSL(2.066) Net::FTP>>> IO::Socket::IP(0.39) Net::FTP>>> IO::Socket(1.39) Net::FTP>>> IO::Handle(1.39) Net::FTP=GLOB(0x363bc80)<<< 220 Service ready for new user. Connected OK Net::FTP=GLOB(0x363bc80)>>> TYPE I Net::FTP=GLOB(0x363bc80)<<< 530 Access denied. Can't switch to binary mode: at /home/username/bin/perltest line 9.
At first I thought that it was the choice of FTP server that was the issue, but the same results occur for several servers. Then I suspected Android was preventing access to the directory and it's contents but if so, why was I not reeiving any errors when I used the ftp program from the CLI of my PC?
I've used and continue to use Net::FTP to interact with other non-Android hosts without issue, but I can't get it to work with an Android host, and I've tried three of them. Because the CLI client works fine, I have to suspect that Net::FTP is at fault.
Either that, or I've made a really stupid mistake somewhere in my coding?
Suggestions, corrections, observations... all welcome.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Issues with Net::FTP and Android
by tobyink (Canon) on Jun 19, 2023 at 17:05 UTC | |
by amcleod (Novice) on Jun 19, 2023 at 19:04 UTC | |
by afoken (Chancellor) on Jun 19, 2023 at 22:07 UTC |