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

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

[复制链接]
发表于 2012-9-13 16:13:10 | 显示全部楼层 |阅读模式
本帖最后由 拉风晓晓 于 2012-9-13 21:36 编辑
  1. #RequireAdmin
  2. #include <FTPEx.au3>
  3. Local $sDbPath,$s_RemoteFile,$fileserver,$username,$pass,$Conn,$RESUT,$h_Handle,$aFile,$remote_time,$local_time,$local_size
  4. $sDbPath= @ScriptDir & "\1.txt"
  5. $s_RemoteFile="/1.txt"
  6. $fileserver = '563221212.svfree.net'
  7. $username = '563221212'
  8. $pass = '123456'
  9. $Open = _FTP_Open('MyFTP Control')
  10. $Conn = _FTP_Connect($Open, $fileserver, $username, $pass,1,21)
  11. $aFile = _FTP_FindFileFirst($Conn,$s_RemoteFile, $h_Handle)
  12. $remote_time=_FTP_FileTimeLoHiToStr($aFile[6],$aFile[7],1)
  13. ConsoleWrite(@crlf&'远程文件时间'&$remote_time)
  14. ConsoleWrite('大小'&$aFile[9] & @CRLF)
  15. _FTP_FindFileClose($h_Handle)
  16. $filetime=FileGetTime($sDbPath,0)
  17. $local_size=FileGetSize($sDbPath)
  18. If $filetime=0  Or $local_size<11000 Then
  19.         $RESUT= _FTP_Fileget($Conn,$s_RemoteFile,$sDbPath)
  20.         ConsoleWrite(@CRLF&'新下载'&$RESUT&@crlf)
  21. Else
  22.                 $local_time=$filetime[0]-1&"/"&$filetime[1]&"/"&$filetime[2]&" "&$filetime[3]&":"&$filetime[4]&":"&$filetime[5]
  23.                
  24.                 ConsoleWrite('本地文件时间'&$local_time&'大小'&$local_size)
  25.                 Local $time_cmp=StringCompare($remote_time,$local_time)
  26.                 ConsoleWrite(@crlf&'服务器-本地='&$time_cmp&@crlf)
  27.                  If $time_cmp<0  And $local_size>11000 Then
  28.                 $RESUT= _FTP_Fileput($Conn,$sDbPath,$s_RemoteFile)
  29.                  ConsoleWrite(@crlf&'上传'&$RESUT&@crlf)
  30.                  Else
  31.                  $RESUT= _FTP_Fileget($Conn,$s_RemoteFile,$sDbPath)
  32.                  ConsoleWrite(@CRLF&'下载'&$RESUT&@crlf)
  33.                  EndIf
  34.                
  35. EndIf
  36. _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, 2026-9-25 08:02 , Processed in 0.077043 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2026 Discuz! Team.

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