Directory()

Post Reply
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Directory()

Post 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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org

********************************************************************
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Directory()

Post 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.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Directory()

Post 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 ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Re: Directory()

Post by Otto »

Hello Antonio,

thank you. I use it like you wrote.
But the timeout is the same.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org

********************************************************************
Post Reply