FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Pocket PC Directory()
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Directory()
Posted: Mon Sep 05, 2011 06:00 PM
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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Directory()
Posted: Tue Sep 06, 2011 06:49 PM
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.net/viewvc/harbour-project/trunk/harbour/src/rtl/direct.c?revision=14811&view=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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Directory()
Posted: Wed Sep 07, 2011 06:32 PM

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
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Directory()
Posted: Sat Sep 10, 2011 10:05 AM

Hello Antonio,

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

Continue the discussion