Jump to content

Recommended Posts

Posted

I'm having a problem retrieving a file via ftp. Here is a basic reproduction of the code I used from the helpfile. According to google, error 12002 is a timeout issue, but my test file is only 40kb so I don't see how that's possible. I've verified the path via ftp client copy paste and matched up with what I have in the code. I've tried without a firewall and still have the same issue. I've logged in to the server via ftp client with no issue.

What else can I try?

Code:

#include <FTPEx.au3>
#include <MsgBoxConstants.au3>

_Example()

Func _Example()

    $APPTITLE = "Inventory"
    $REGLOCATION = "HKEY_CURRENT_USER\SOFTWARE\" & $APPTITLE

    Global $rFTPServer = RegRead($REGLOCATION, "FTPServer")
    Global $rFTPUser = RegRead($REGLOCATION, "FTPUser")
    Global $rFTPPass = RegRead($REGLOCATION, "FTPPass")

    Local $hOpen = _FTP_Open('MyFTP Control')

    Local $hConn = _FTP_Connect($hOpen, $rFTPServer, $rFTPUser, $rFTPPass)
    If @error Then
        MsgBox($MB_SYSTEMMODAL, '_FTP_Connect', 'ERROR=' & @error)
    Else
        Local $iErr = @error, $sFTP_Message
        _FTP_GetLastResponseInfo($iErr, $sFTP_Message)
        ConsoleWrite('$iErr=' & $iErr & '   $sFTP_Message:' & @CRLF & $sFTP_Message & @CRLF)
        ; do something ...
    EndIf


    $sFTPFile = _FTP_FileGet ( $hConn, "/image/XXXXXX/testimage.jpg", "C:\XXXXXX\testimage.jpg")
    If @error Then
        ConsoleWrite("!  " & @error & " ---- " & @extended & " ---- " & $sFTPFile & @CRLF)
    EndIf


    _FTP_Close($hConn)
    _FTP_Close($hOpen)

EndFunc   ;==>_Example

 

Consolewrite Error

$iErr=0   $sFTP_Message:
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 3 of 150 allowed.
220-Local time is now 16:22. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 30 minutes of inactivity.
331 User XXXXXX OK. Password required
230 OK. Current restricted directory is /

!  -1 ---- 12002 ---- 0

 

Posted

Issue resolved. Even though I turned the firewall off, it still didn't work, but I added autoit to the allow app through settings and that worked.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...