找回密码
 加入
搜索
查看: 2409|回复: 2

[网络通信] FTP同步,XP下正常编译运行,WIN7运行报错(已解决)

[复制链接]
发表于 2012-9-13 16:13:10 | 显示全部楼层 |阅读模式
本帖最后由 拉风晓晓 于 2012-9-13 21:36 编辑
#RequireAdmin
#include <FTPEx.au3>
Local $sDbPath,$s_RemoteFile,$fileserver,$username,$pass,$Conn,$RESUT,$h_Handle,$aFile,$remote_time,$local_time,$local_size
 $sDbPath= @ScriptDir & "\1.txt"
 $s_RemoteFile="/1.txt"
 $fileserver = '563221212.svfree.net'
 $username = '563221212'
 $pass = '123456'
 $Open = _FTP_Open('MyFTP Control')
 $Conn = _FTP_Connect($Open, $fileserver, $username, $pass,1,21)
 $aFile = _FTP_FindFileFirst($Conn,$s_RemoteFile, $h_Handle)
 $remote_time=_FTP_FileTimeLoHiToStr($aFile[6],$aFile[7],1)
ConsoleWrite(@crlf&'远程文件时间'&$remote_time)
ConsoleWrite('大小'&$aFile[9] & @CRLF)
_FTP_FindFileClose($h_Handle)
$filetime=FileGetTime($sDbPath,0)
$local_size=FileGetSize($sDbPath)
If $filetime=0  Or $local_size<11000 Then 
        $RESUT= _FTP_Fileget($Conn,$s_RemoteFile,$sDbPath)
        ConsoleWrite(@CRLF&'新下载'&$RESUT&@crlf)
Else
                $local_time=$filetime[0]-1&"/"&$filetime[1]&"/"&$filetime[2]&" "&$filetime[3]&":"&$filetime[4]&":"&$filetime[5]
                
                ConsoleWrite('本地文件时间'&$local_time&'大小'&$local_size)
                Local $time_cmp=StringCompare($remote_time,$local_time)
                ConsoleWrite(@crlf&'服务器-本地='&$time_cmp&@crlf)
                 If $time_cmp<0  And $local_size>11000 Then 
                $RESUT= _FTP_Fileput($Conn,$sDbPath,$s_RemoteFile)
                 ConsoleWrite(@crlf&'上传'&$RESUT&@crlf)
                 Else
                 $RESUT= _FTP_Fileget($Conn,$s_RemoteFile,$sDbPath)
                 ConsoleWrite(@CRLF&'下载'&$RESUT&@crlf)
                 EndIf
                
EndIf
 _FTP_Close($Open)
 楼主| 发表于 2012-9-13 21:31:38 | 显示全部楼层
自己解决了,实际代码不是这个FTP服务器
当$aFile = _FTP_FindFileFirst($Conn,$s_RemoteFile, $h_Handle)这句时,FTP服务器没有回应值,造成$aFile[6],$aFile[7]都是错误的数
发表于 2012-9-13 21:34:04 | 显示全部楼层


win7 x86
au3:3.3.7.15

这个应该算正常吧,没发现报错。。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-6-2 22:11 , Processed in 0.081268 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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