Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using VFP to push data
Message
De
09/01/2007 15:29:00
Al Doman (En ligne)
M3 Enterprises Inc.
North Vancouver, Colombie Britannique, Canada
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Network:
Windows 2000 Pro
Database:
Visual FoxPro
Divers
Thread ID:
01183853
Message ID:
01183946
Vues:
23
>hi all,
>i was wondering if anyone had used VFP to push data based on events. what i was thinking about was having a simple message centre that would be updated when someone sent a message to that person and instead of using a timer to update the screen every 60 seconds have the sender push the mesage to the recipient.
>~M

Fundamentally, there is no such thing as "push". You can't send anything to me unless I've configured something on my system to listen for things from you. It would be without a doubt, the largest disaster in computing history if true "push" existed. If you think spam is bad, could you imagine what your system would be like if advertisers could push stuff onto your screen at will??

As others have pointed out, you can hook into or configure processes that may exist and/or already be running that are, or can, act as listeners/servers - for example, Outlook. Or, as you've already pointed out, you can create your own listener by using a timer in VFP and polling something like a shared table to look for new messages. At the lowest level, all "server/listener" processes are polling - periodically looking at inputs and looking for something that's changed, and responding accordingly.

You probably want to implement some sort of "push" as you call it, because you want a sent message to "instantly" appear at the recipient. Well, since some process on the recipient is polling, receiving the message cannot ever be instantaneous. It can be very short, milli- or microseconds with well-written interrupt handlers on modern hardware. The question you really need to ask is, what is "good enough"?

For a lot of computing jobs, a sub-2 second response time is considered "good enough". Sub-second response is usually considered "pretty good" or even "snappy". Using your example of a VFP timer, if you set its timeout to 1 second or even 0.5 seconds (500 milliseconds) you'd likely find message-sending performance would be plenty good enough.

You might be concerned that setting a 1 or 0.5 second timeout period will hog CPU resources. Test it and see - you may be surprised how efficient VFP timers are when not actually doing anything (i.e. when there isn't a new message to be processed). Often only a few percent (or less) CPU utilization even on modest hardware.

If you're interested in binding to events rather than using a timer, depending on exactly what you want to bind to, you might want to upgrade to VFP9. My understanding is that its event binding capabilities are substantially improved over earlier versions.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform