How to monitor a network directory?

How to monitor a network directory?

Postby Otto » Thu Jun 25, 2009 9:46 pm

What is the best way to monitor a network directory.
Thanks in advance
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6033
Joined: Fri Oct 07, 2005 7:07 pm

Re: How to monitor a network directory?

Postby MarcoBoschi » Fri Jun 26, 2009 10:31 am

Otto,
please explain the problem in details.

marco
User avatar
MarcoBoschi
 
Posts: 1016
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: How to monitor a network directory?

Postby Davide » Fri Jun 26, 2009 12:44 pm

Otto,

Otto wrote:What is the best way to monitor a network directory.

I normally use DIRECTORY("\\server\share"), even though on some systems, especially Vista, if the path is non-existant the function hangs the prg (at least with FWH7.09 and related xHarbour, I'm still not ready to use 9.05 in a production environment)

Hi,
Davide
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: How to monitor a network directory?

Postby Maurizio » Fri Jun 26, 2009 2:06 pm

Ciao Otto

Try to chek if the directoty exist .

IF ! lIsDir("\\server\share" )
lMkDir( \\server\share")
ENDIF

Regards MAurizio
User avatar
Maurizio
 
Posts: 797
Joined: Mon Oct 10, 2005 1:29 pm

Re: How to monitor a network directory?

Postby Otto » Fri Jun 26, 2009 3:45 pm

Hello Maurizio, Marco, Davide,

The problem I have is with my restaurant software.
Image
On the graphic you see a typical configuration we use.

There is a fileserver, 1 or more ECRs and 1 or more IPAQS.

On the server we have 1 directory where all the open tables are stored each table as a dbf-file.

On the devices we use the directory() function with a timer to know which tables are occupied.

If an ECR or IPAQ work on a table we write a ASCII - file with the table name and the extension ldb (lock file).
If there is a ldb file the table is locked for the others otherwise free.

On the server is our FW software running. This software cares for printing. If the file is printed the ldb-file is deleted.
So the other devices know that the table is free again.

From the ECR the directory() function or file() function needs 4 sec to notice that the ldb-file is deleted.
The IPAQ notice this within milliseconds.

I made some more tests:
If the FW software which prints and deletes the ldb-files run on the ECR and only the files are on the server you too get noticed immediately.

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6033
Joined: Fri Oct 07, 2005 7:07 pm

Re: How to monitor a network directory?

Postby James Bott » Fri Jun 26, 2009 11:22 pm

Otto,

Why did you choose that design instead of just a DBF containing a record for each table? I'm not suggesting a redesign--just curious.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: How to monitor a network directory?

Postby nageswaragunupudi » Sat Jun 27, 2009 2:53 am

James Bott wrote:Otto,

Why did you choose that design instead of just a DBF containing a record for each table? I'm not suggesting a redesign--just curious.

James


I too support Mr James' advice
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10263
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: How to monitor a network directory?

Postby Otto » Sat Jun 27, 2009 6:47 am

Hello James, hello Mr. NageswaraRao,


I came to this design after trying many different ways over the years.

• For me the main reason is stability and safety:
it is more secure to have one dbf per physically guest table or seat - in most cases there are less than 20 records in it - if there is a problem with corruption only one table is affected.
With ECR PC and WLAN access you always have a not 100% stable net. So if you work on one dbf file many times you have a data corruption.
• Flexibility: how would you handle drag and drop of meals inside a bill – I can’t imagine how to create such an index if you have to select a table number and then the sorting
• Speed: if the restaurant/bar has a high frequency a unique dbf would grow and then how to handle the paid bills – a kind of record recycling would be necessary this with indexes could make problems
• As far as I know record or file locking with pocket PC is not working at the moment - I resolved this with writing a file to let the others know that a bill is in work – locked.



I insert 2 screenshots:
You see the ECR table select screen in the background, the IPAQ in the emulator screen and the corresponding dbf-files in TC.
The second screen shows how the dbf-file gets locked if you work on a table (table 11 in this case).
In this demo I use the mode “All waiters on all tables”. We have other modes, too. For example that one waiter has “his” tables. This information we store in the dbf-file name. example: 011-9999.dbf



Why do you think one dbf-file would be an advantage?

Best regards,
Otto

Image

Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6033
Joined: Fri Oct 07, 2005 7:07 pm

Re: How to monitor a network directory?

Postby xProgrammer » Sat Jun 27, 2009 7:15 am

Hi Otto

>From the ECR the directory() function or file() function needs 4 sec to notice that the ldb-file is deleted.
>The IPAQ notice this within milliseconds.

Curious! You are polling for the non-existence of a file from both the ECR and the IPAQs I assume. If the IPAQ consistently notices that the table is free within milliseconds then it must be polling that frequently. The only reasons I can think of for the ECR taking so much longer are one or more of the following:

1. A different polling rate on the ECR which could be due to timer settings, but could also be due to the ECR being busy with higher priority tasks.
2. Some networking problem that is making the connection to the ECR slow
3. Some form of buffering / caching that affects the ECR but not the IPAQs
4. Is the code operating in the same way on the ECR and the IPAQs

I'm not sure why a 4 second delay is an issue here - I would have thought that would have been acceptable.

There are arguably better designs but if you investigate the above possible causes you may find a practical solution that is easier. Some things that might be worth trying:

1. See how busy the ECR is
2. See if it detects tables being empty faster if only 1 IPAQ is on (polling) and / or if you reduce the polling rate on the IPAQs.
3. Maybe even see if the ECR responds faster if it uses wireless acess like the IPAQs (seems unlikely though).

Ideally the server would push the availability of tables to ECR and the IPAQs, but this is an unusual design in that you would have essentially one client (the server) talking to many servers (the IPAQs and the ECR).

Staying with a polling design I would suggest making the polling rate adjustable so that you can optimise the setting - you may have to reduce polling frequency to avoid server overload. Remember that directory / file searches are rather inefficient. You could use an xBase table, as others have suggested, or if you want real efficiency an array or hash on the server

Good luck!

Regards

Doug
User avatar
xProgrammer
 
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Re: How to monitor a network directory?

Postby James Bott » Sat Jun 27, 2009 12:40 pm

Otto,

I, like Doug, am concerned about the polling rate and why you need to know faster than 4 seconds. Polling from each device faster than every second is going make a lot of network traffic. Have you run the task manager on the server to see how busy the CPU is? It is also causing a lot of disk reads.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: How to monitor a network directory?

Postby Willi Quintana » Sat Jun 27, 2009 2:12 pm

HI Friend,,
You should work with mysql, there is a version that works with mysql FWPPC, would be much easier remote access from a mobile PC,
sorry my enghish is bad.

Regards
Willi
User avatar
Willi Quintana
 
Posts: 1002
Joined: Sun Oct 09, 2005 10:41 pm
Location: Cusco - Perú

Re: How to monitor a network directory?

Postby Otto » Sat Jun 27, 2009 4:46 pm

Hello James, hello Doug, hello Willi,

Thank you for your help. You are right concerning the polling rate.
I don’t use in real-time such a small value. We have had with our old software a value of 1500 msec.
My problem is , was - if I use WINDOWS 2000 all is done within msec – the access of the new file and the file() check.

With WINDOWS 2000 all is working excellent. Maybe I find out what with WINDOWS XP is different. I also noticed a slow dbf-access in other circumstances with XP as SERVER if a dbf-file is opened by more than one user. Luckily XP is not much used as SERVER among my customers.

>You should work with mysql
Willi I could hardly imagine that mySQL could be a better solution.

But I don’t know anything about mySQL. But I think it is much the same as SQL Server. I did some work with SQL especially for my booking system on the internet. But I had problems with speed. Maybe the provider had to many users on one SQL server.
I changed to ACCESS and I use ACCESS databases in the way of dbase files I mean I create one access database for every table like we have in dbase.
This way I have a very fast data access. But in terms of database I only have small data tables.


http://www.atzwanger-software.com/fw/Biene_onehand_symbol/Biene_onehand_symbol.htm

Please have a look at the video between 0:27 and 0:31.
It could be done even faster but I missed the button the first time. I was nervous because of the video registration..

Here is what the software does in this time:
- Create a look file
-Send the table dbf file with filecopy to the server – there my FW-software prints the order and
copies the file to the directory where the bills are stored and deletes the lock file.

- then I reopen the table for billing.
-again a lock file is created on the server
– with filecopy I copy the table dbf back to the IPAQ and open the local dbf file.

The advantage of this system is that I need only some msec. a stable WLAN connection.
Also error handling is easy – I check the return value of filecopy.

Best regards,
Otto

Video: PPC solution mobile ECR
http://forums.fivetechsupport.com/viewtopic.php?f=4&t=15590
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6033
Joined: Fri Oct 07, 2005 7:07 pm

Re: How to monitor a network directory?

Postby Maurizio » Sat Jun 27, 2009 8:35 pm

Hello Otto

I have a programm for restaurants that works like yours. I send the DBF files to pocket PC
and viceversa . All work fast and very well .

Example:

From the pocket PC
1 . Check if the wireless is ON
2 . Check if the server is ON and if the background programm on the server is ON .
3 . I send to the server a table situation request
4 . The server answers with a file ( 200b for 200 tables ) which tables are free

All this in less than 1 second.

Regards Maurizio
User avatar
Maurizio
 
Posts: 797
Joined: Mon Oct 10, 2005 1:29 pm

Re: How to monitor a network directory?

Postby Otto » Sat Jun 27, 2009 9:15 pm

Hello Maurizio,

Thank you for your answer.

May I ask you how you do the following tasks:

From the pocket PC
1 . Check if the wireless is ON
I check the existence of a file on the server.
2 . Check if the server is ON and if the background programm on the server is ON .
I check the creation time of the file – the background program recreates this file periodically.
3 . I send to the server a table situation request
I use ASCII – lock files with the extention ldb and the table name to show a locked table
I check with directory() function.
4 . The server answers with a file ( 200b for 200 tables ) which tables are free
All tables from the table definition file which have no lock file are free.

What OS is on your server installed?

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6033
Joined: Fri Oct 07, 2005 7:07 pm

Re: How to monitor a network directory?

Postby Maurizio » Tue Jun 30, 2009 6:55 am

Hello Otto

1 . Check if the wireless is ON

FOR nX := 1 TO 10
inetinit()
aIpDNS:=InetGetHosts(Getenv("ComputerName"))
inetcleanup()
IF len(aIpDNS) >= 1
IF aIpDNS[1] == "127.0.0.1"
::lRete := FALSE
ELSE
::lRete := TRUE
exit
ENDIF
ELSE
::lRete := FALSE
ENDIF
sleep(200)
NEXT

2 . Check if the server is ON and if the background programm on the server is ON .
I create a file when the programm start
IF file(m->cServer + "in\ATTESA.OK")
::lRete := TRUE
ELSE
MsgInfo("No Serever")
ENDIF



3 . I send to the server a table situation request
I send a ASCII file with the number of the pocket PC and a tag Example: "01TABLE"
4 . The server answers with a file ( 200b for 200 tables ) which tables are free
I send a ASCII File with 0 or 1 Example "00001011 ecc..

What OS is on your server installed?
Windows XP

Ciao Maurizio
User avatar
Maurizio
 
Posts: 797
Joined: Mon Oct 10, 2005 1:29 pm

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 17 guests