Page 1 of 1

Directory()

Posted: Mon Sep 05, 2011 6:00 pm
by Otto
Hello Antonio,

may I ask your help with FWPPC

To check if I have access to the server I use
1. ping()
2. then I read the file attributes date/time of a file on the network.

Now I logged the steps and found out that if there is a problem with
Directory() it takes 30 sec. till a timeout comes and during this time the
IPAQ is frozen.

5.09.2011 15:41:31: hReturn
05.09.2011 15:41:32: else von ping
05.09.2011 15:41:32: directory ok
05.09.2011 15:41:32: hReturn
05.09.2011 15:49:23: else von ping

aInfo := Directory( cNETZ_DBF )

If Len( aInfo ) > 0
logfile( curdir() + "\netz.log", { "directory ok" } )
else
logfile( curdir() + "\netz.log", { "WNETDISCONNECTDLG" } )
endif



05.09.2011 15:49:48: WNETDISCONNECTDLG
05.09.2011 15:49:56: else von ping
05.09.2011 15:49:56: directory ok
05.09.2011 15:49:56: hReturn
05.09.2011 15:49:57: else von ping


Do you think it is possible to use a timer which kills the directory() after 1 sec.
or do you have another solution.

Thanks in advance
Otto

Re: Directory()

Posted: Tue Sep 06, 2011 6:49 pm
by Antonio Linares
Otto,

function Directory() source code is provided in Harbour source code, and it is based -mainly- in two functions hb_fsFindFirst() and hb_fsFindNext(). Here it is:

http://harbour-project.svn.sourceforge. ... iew=markup

If the delay comes from hb_fsFindFirst() I guess there is little to do, unless we use a thread to stop it. We have never tried to stop a Windows API function from a thread so this may be our first try :-)

If the delay comes from hb_fsFindNext() then maybe we can control the time between each call to such function and exit Directory() if it takes too long.

Re: Directory()

Posted: Wed Sep 07, 2011 6:32 pm
by Antonio Linares
Otto,

function Directory( cFileName ) allows to specify the name of the file
to retrieve, this way you don't have to retrieve all files info :-)

Have you tried it ?

Re: Directory()

Posted: Sat Sep 10, 2011 10:05 am
by Otto
Hello Antonio,

thank you. I use it like you wrote.
But the timeout is the same.
Best regards,
Otto