我写了一些访问FTP服务器并下载平面文件的代码。它可以在我的WAMP (Windows5.3.10)开发环境中工作,但在生产服务器(5.3.2 - Linux)上调用ftp_nlist时会失败。
它在那里停留了大约30秒,然后死了,并显示了编码错误消息[FTP] Unable to retrieve files in the directory。
相关代码如下:
$link = ftp_connect(constant("FTP_SERVER"));
if(!$link)
die("Unable to open connection to FTP Server:
我在Windows 2012机器上有一个FTP服务器,我正在尝试从它获取setup.exe。
CMD.EXE日志:
C:\>ftp 1.2.3.4
Connected to 1.2.3.4.
220-FileZilla Server version 0.9.45 beta
220-written by Tim Kosse (tim.kosse@filezilla-project.org)
220 Please visit http://sourceforge.net/projects/filezilla/
User (1.2.3.4:(none)): my_username
331 Pa
状态: 连接成功
命令: OPTS UTF8 OFF
响应: 200 OPTS UTF8 command successful - UTF8 encoding now OFF.
状态: 正在取得目录列表...
命令: PWD
响应: 257 "/" is current directory.
命令: PASV
响应: 227 Entering Passive Mode (119,28,224,211,220,237).
命令: TYPE A
响应: 200 Type set to A.
命令: LIST
响应: 150 Opening ASCII mod
是否有人成功地使用.Net FTPWebRequest类从NAT后面传送到远程服务器?我的代码如下:
Dim URI = "ftp://" & sRemoteDir & "/"
Dim ftp As FtpWebRequest = Nothing
Try
ServicePointManager.ServerCertificateValidationCallback = AddressOf ValidateServerCertificate
ftp = CType(FtpWebRequest.Create(URI), Ft
我有一个运行linux/WHM/cpanel的远程服务器,通过SSH (通过相同的internet连接)连接该服务器没有任何问题。
但是,当我试图连接FTP时,有时它会工作,有时它会给我以下消息:
Server said: I won't open a connection to 192.168.1.4 (only to 78.xxx.xxx.xxx)
Error -162: PORT failed
有时候它只是起作用,而有时却不起作用!
78.xxx.xxx.xxx IP是我在本地计算机上使用whatismyip.com检查ip时看到的。
此外,如果我使用不同的互联网连接,它可以
客户端首先进入被动模式,因为我不知道远程FTP服务器是主动模式还是被动模式。
一般来说,一个人首先进入被动模式。
守则如下:
FTPClient ftpClient = new FTPClient();
ftpClient.connect(ip,port);
ftpClient.login(id,pw);
ftpClient.enterLocalPassiveMode();
...
(occur mode error)
(I use try-catch in case an error occurs)
(active mode reconnect)
...
ftpClient.logout()
由于某些原因,当我尝试使用get或put从Solaris计算机到IBM大型机时,ftp客户端似乎挂起了。
我尝试了各种不同的变体(例如,包括使用引号和不使用引号),我得到的结果都是"200 Port Request OK“。但我再也没有得到提示,最终连接中断。
ftp> open ibm.some_server
Connected to ibm.some_server
230 USER1 is logged on. Working directory is "USER1.".
Remote system type is MVS.
今年,在我的工程学课上,我们正在学习操作系统和Shell编程。我在FTP上保存了一个备份,它过去工作正常,但是现在我在上传和下载到服务器时得到了这个错误:
ftp> dir
500 I won't open a connection to 10.23.28.243 (only to 1.23.149.28)
ftp: bind: Address already in use
&
ftp> put asdf.sh
local: asdf.sh remote: asdf.sh
500 I won't open a connection to 10.23.28.2
我试图在ant中通过ftp拉出文件,在打印“获取文件”后挂起,所以我在ant中启用了debug,我的输出是
[root@LODIVM11SE001 net]# ant -d -f ftp_t.xml
Apache Ant version 1.6.5 compiled on June 2 2005
Buildfile: ftp_t.xml
Adding reference: ant.PropertyHelper
Detected Java version: 1.5 in: /root/jdk1.6.0_10/jre
Detected OS: Linux
Adding reference: ant
我正在尝试为我的NAS开发一个基于web的FTP客户端。当我尝试获取NAS上所有文件的列表时,脚本将永远加载。如果我尝试通过PHP连接到我的webhost,一切都很好,我可以得到所有文件的列表。如果我在Mac OS中通过终端运行该脚本,那么获取我的NAS上的文件列表是没有问题的。
谁能告诉我为什么我不能检索我的NAS上的文件列表?我连接到我的IP地址(当然不是本地IP:-),并且我的端口不是默认的21而是2121,这有关系吗?
下面是我的脚本。
// Set IP and port
define("FTP_CONNECT_IP", "");
define(
我正试图通过Azure App服务从Azure VM直接上传/下载一些文件,但是应用程序返回以下错误:
System.Net.WebException:远程服务器返回一个错误:(501)参数或参数中的语法错误。
我使用的是blazor,这是我用来上传的代码:
{
// Get the object used to communicate with the server.
FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://xxx.xxx.xxx.xxx/dir/file.conf"