找回密码
 加入
搜索
查看: 3023|回复: 6

[系统综合] ftp内外网问题

[复制链接]
发表于 2011-11-23 12:32:56 | 显示全部楼层 |阅读模式
本帖最后由 liangxm 于 2011-11-23 12:36 编辑

#include <FTPEx.au3>
$server = '10.2.10.7'  ;服务器
$name = 'test'              ;用户名
$pass = '123456'              ;密码
$s_LocalFile = "D:\ITS\liangxm.txt"                        ;本地上传文件
$s_RemoteFile = "\liangxm.txt"                        ;上传服务器文件

$nSize = InetGetSize("ftp://test:123456@10.2.10.7/1.txt")
MsgBox(0,"提示框","文件大小:" & $nSize)

;$nSize = InetGetSize("ftp://test:123456@10.2.10.7/1.txt")
;MsgBox(0,"提示框","文件大小:" & $nSize)

$Open = _FTP_Open('MyFTP')  ;打开一个FTP会话
$Conn = _FTP_Connect($Open,$server,$name,$pass)  ;连接到ftp服务器

MsgBox(0,"连接",$Conn)

$ftp_upload = _FTP_FilePut($Conn,$s_LocalFile,$s_RemoteFile)  ;上传文件
;$ftp_upload = _FTP_FilePut($Conn,"D:\ITS\liangxm.txt","\Remote Debugger\liangxm.txt")  ;上传文件

MsgBox(0,"上传",$ftp_upload)

$Ftpc = _FTP_Close($Open)  ;关闭 _FTP_Open 打开的回话


------------------------------------------------------------------------------------------------------------

测了一下,内网ftp没有问题,把ip,账号,密码换成外网的就有问题了:
InetGetSize()取不到大小
Conn = _FTP_Connect不为0,说明账号密码应该没有问题,已经连上ftp了
$ftp_upload = _FTP_FilePut这个一直0,说明没有上传成功/连另一个外网ftp直接运行到此卡住不动


不知道这样内网ftp可以,外网ftp不行一般问题会出现在哪?好像这个也没有多的什么返回值,debug信息,不知道是哪里的问题。
发表于 2011-11-23 13:59:27 | 显示全部楼层
InetGetSize要头文件 <IE.au3>
发表于 2011-11-23 14:00:56 | 显示全部楼层
外网ftp测试成功...
 楼主| 发表于 2011-11-23 14:52:56 | 显示全部楼层
InetGetSize要头文件
amxi 发表于 2011-11-23 13:59



    试过内网,不加也可以的
 楼主| 发表于 2011-11-23 14:53:59 | 显示全部楼层
外网ftp测试成功...
amxi 发表于 2011-11-23 14:00



    你把代码换成你的外网ftp可以用吗?
难道是我rpwt?还是我的ftp哪里设置有问题?我用工具连,操作都没问题,用au3代码就不行
 楼主| 发表于 2011-11-23 17:21:42 | 显示全部楼层
本帖最后由 liangxm 于 2011-11-23 17:56 编辑

(000062)2011-11-23 17:19:33 - (not logged in) (110.86.14.98)> USER ad
(000062)2011-11-23 17:19:33 - (not logged in) (110.86.14.98)> 331 Password required for ad
(000062)2011-11-23 17:19:33 - (not logged in) (110.86.14.98)> PASS ******
(000062)2011-11-23 17:19:33 - ad (110.86.14.xx)> 230 Logged on
(000062)2011-11-23 17:19:34 - ad (110.86.14.xx)> TYPE I
(000062)2011-11-23 17:19:34 - ad (110.86.14.xx)> 200 Type set to I
(000062)2011-11-23 17:19:34 - ad (110.86.14.xx)> PORT 10,2,10,7,239,175
(000062)2011-11-23 17:19:34 - ad (110.86.14.xx)> 200 Port command successful
(000062)2011-11-23 17:19:34 - ad (110.86.14.xx)> STOR liangxm.txt
(000062)2011-11-23 17:19:34 - ad (110.86.14.xx)> 150 Opening data channel for file transfer.
(000062)2011-11-23 17:19:44 - ad (110.86.14.xx)> 425 Can't open data connection.

服务器上日志,百度了一下,估计是防火墙,ftp服务器设置,主动被动模式的问题,不知道有没有什么办法呢?
 楼主| 发表于 2011-11-23 17:57:38 | 显示全部楼层
[ INFO] 2011-11-23 17:39:00,198 [ad] [110.86.14.xx] RECEIVED: STOR /update.xx.com/liangxm.txt
[ WARN] 2011-11-23 17:39:44,199 [ad] [110.86.14.xx] FtpDataConnection.getDataSocket()
[ INFO] 2011-11-23 17:39:44,200 [ad] [110.86.14.xx] SENT: 150 File status okay; about to open data connection.
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-20 22:50 , Processed in 0.081083 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表