Jump to content

Recommended Posts

Posted (edited)

As for now I was using such kind of snippet:

Local $aFTP_FileList = _FTP_ListToArray($hFTPSession, 2)
For $iFTPFileSize_idx = 1 To $aFTP_FileList[0]
    ConsoleWrite('Pobieram informacje o pliku:' & $aFTP_FileList[$iFTPFileSize_idx] )
    $iWielkoscPliku = _FTP_FileGetSize($hFTPSession, $aFTP_FileList[$iFTPFileSize_idx])
    ConsoleWrite($iFTPFileSize_idx & ' : ' & $aFTP_FileList[$iFTPFileSize_idx] & ' rozmiar=' & $iWielkoscPliku)
    Sleep(200)
Next

 

But from some time my clients start buying cheap WD MyCloud NAS, and my problems starts.
On all others NAS there is no problem (Seagate BlackArmour, QNAP, SYNOLOGY .... ).


When on list there is for example 20 files then first two of them are very fast checked and reported they FileSize.
After 2 files there is about 20 sec stop....... and next two files are checked with no errors but FileSize == 0 
again there is about 20 sec stop....... and next two files are checked with no errors but FileSize == 0 
again there is about 20 sec stop....... and next two files are checked with no errors but FileSize == 0 
again there is about 20 sec stop....... and next two files are checked with no errors but FileSize == 0 
again there is about 20 sec stop....... and next two files are checked with no errors but FileSize == 0 
.......

 

In time when I process investigation I checked how :  _FTP_ListToArray2D and _FTP_ListToArrayEx works and I was shocked that they works super fast.

 

Here are the questions:
Q1: Why does the problem occur only on WD MyCloud NAS?
Q2: What is the significant difference that makes using _FTP_ListToArray2D and _FTP_ListToArrayEx to retrieve file sizes is still fast?
Q3: Why _FTP_FileGetSize() not reporting @errors but returned FileSize = 0 

 

Regards,
mLipok

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Hello. 

Q1: Why does the problem occur only on WD MyCloud NAS?

I never used one of that. 


Q2: What is the significant difference that makes using _FTP_ListToArray2D and _FTP_ListToArrayEx to retrieve file sizes is still fast?

It internally use $tWIN32_FIND_DATA structure to get the File returned using FtpFindFirstFileW. Maybe FtpGetFileSize + FtpOpenFileW are slower. (I really don't know I don't want to look into this internally)


Q3: Why _FTP_FileGetSize() not reporting @errors but returned FileSize = 0 

To check this you probably need to look into the udf FtpOpenFileW and FtpGetFileSize.

 

If you think _FTP_ListToArray2D  and _FTP_ListToArrayEx work faster than _FTP_FileGetSize, You probably could build a FileGetSize using _FTP_ListToArrayEx,_FTP_ListToArray2D   method. Something like this:

Func _FTP_FileGetSizeEx($hFTPSession, $sFileName)
    Local $tWIN32_FIND_DATA = DllStructCreate($tagWIN32_FIND_DATA)
    Local $aCallFindFirst = DllCall($__g_hWinInet_FTP, 'handle', 'FtpFindFirstFileW', 'handle', $hFTPSession, 'wstr', $sFileName, 'struct*', $tWIN32_FIND_DATA, 'dword', $INTERNET_FLAG_NO_CACHE_WRITE, 'dword_ptr', 0)
    Local $iSize = _WinAPI_MakeQWord(DllStructGetData($tWIN32_FIND_DATA, "nFileSizeLow"), DllStructGetData($tWIN32_FIND_DATA, "nFileSizeHigh"))
    DllCall($__g_hWinInet_FTP, 'bool', 'InternetCloseHandle', 'handle', $aCallFindFirst[0])
    Return $iSize
EndFunc   ;==>_FTP_FileGetSizeEx

 

Saludos

 

 

Posted

Hi mLipok,

I own an WDNAS, to verify I tested ftp access and I can confirm your problem - but I get an error from the second entry ond and the error code reported is -1:

Example:

...
*** (0) -> 789297698
*** (-1) -> 0
*** (-1) -> 0
...

I don't know the problem, but both other array-methods work fine:

...
[1]|***|789297698
[2]|***|1014191107
[3]|***|1103390378
...

Greetings

kara

 

 

 

Posted
  On 11/8/2017 at 5:05 PM, kara2004 said:

I get an error from the second entry ond and the error code reported is -1:

Example:

...
*** (0) -> 789297698
*** (-1) -> 0
*** (-1) -> 0

Expand  

The same situation on my side.

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

  • 7 months later...
Posted (edited)

Same situation here, i think there is an error if you have the _FTP_FileGetSize in a recursive scenary, but im not sure about that...

 

@extends drop the real FTP error,

In my case first it drops 12003 " An extended error was returned from the server" and then always 12111 "ERROR_FTP_DROPPED The FTP operation was not completed because the session was aborted."

 

Workaround: Im looking for some other comparsion, like modified date of files.

Edited by barresoft
Posted

I'm using @Danyfirex version I mean _FTP_FileGetSizeEx() which was posted few post above.

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

I have also other ISSUE with WD MyCloud NAS and using FTP with AutoIt.

Frequently I get this kind of error:

421 10 users (the maximum) are already logged in, sorry

Do you have any comment how to fix this issue ?

 

EDIT: REMARKS:
Only my script login to this FTP on this NAS.
My  script login to this FTP every day.

 

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

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...