Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM General » View Thread |
Messages 1 to 4 of 4 total |
Ping question. |
Thu, Mar 24 2016 8:37 AM | Permanent Link |
David | I am having an issue with pinging that I would like some help/advise if anyone can.
I have a situation where users log on via a laptop, do some work then close the laptop down without terminating the app. When they open the laptop back up the app is still active and pinging away, but the session on the server has been removed by this time. I an ApplicationEvents setup with an app wide exception handler, but for the life of me I cannot get this event to fire on the ping event. I can get it to work however if I try and request some other info from the database. What I want to do terminate the application if the ping keeps failing after so many tries. Does anyone know why the ping event is not firing? Do I need to write something myself to manage the ping failure? I am using DBISam4.42 Regards David. |
Thu, Mar 24 2016 9:04 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | David
I'm guessing that when you say "close the laptop down" you mean close the lid and send it to sleep or hibernate. If so, whilst I've never tried it, I assume that the app stops doing anything until the lid is reopened and then it starts up where it left off. By that time the server has gotten bored and dumped the session. I never used c/s in DBISAM so I'm not sure what events you have to play with, and since if my guess is right then machine won't have been in a state to receive anything back from the server its awkward. Since the ping is just to keep the server from thinking you've run away I don't know if Tim even bothers with the response, if he does and its surfaced I can't find it. On the good news side, whilst I don't know anything to handle the pinging I do know about handling the screen powering off / on since I had a problem with it. You can trap for when the screen goes on / off and stop pinging / reconnect as appropriate I hope what I've posted below is of use and understandable. {POWER BROADCAST STUFF} const WM_POWERBROADCAST = 536; PBT_POWERSETTINGCHANGE = $8013; DEVICE_NOTIFY_WINDOW_HANDLE = 0; GUID_MONITOR_POWER_ON: TGUID = '{02731015-4510-4526-99E6-E5A17EBD1AEA}'; type HPOWERNOTIFY = Pointer; PHPOWERNOTIFY = ^HPOWERNOTIFY; PPowerBroadcastSetting = ^TPowerBroadcastSetting; TPowerBroadcastSetting = record PowerSetting: TGUID; DataLength: DWORD; Data: array[0..0] of UCHAR; end; function RegisterPowerSettingNotification(const hRecipient: THandle; const PowerSettingGuid: TGUID; const Flags: DWORD): HPOWERNOTIFY; stdcall; external user32 name 'RegisterPowerSettingNotification'; function UnregisterPowerSettingNotification(Handle: HPOWERNOTIFY): BOOL; stdcall; external user32 name 'UnregisterPowerSettingNotification'; procedure TMainForm.WMPowerBroadcast(var msg: TMessage); var Setting: TPowerBroadcastSetting; begin if msg.WParam = PBT_POWERSETTINGCHANGE then begin Setting := PPowerBroadcastSetting(msg.LParam)^; if IsEqualGUID(Setting.PowerSetting, GUID_MONITOR_POWER_ON) then begin MonitorIsOn := DWORD(Setting.Data[0]) = 1; MonitorOnChange := Now; if MonitorIsOn then begin CheckingAlarms.Active := CheckingAlarms.Tag = 1; BackgroundSearch.Active := BackgroundSearch.Tag > 0; Blinker.Enabled := Blinker.Tag = 1; end else begin CheckingAlarms.Active := False; BackgroundSearch.Active := False; Blinker.Enabled := False; end; end; end; inherited; end; in form create MonitorOnCheck := RegisterPowerSettingNotification(Handle, GUID_MONITOR_POWER_ON, DEVICE_NOTIFY_WINDOW_HANDLE); MonitorIsOn := True; MonitorOnChange := Now; in form close UnregisterPowerSettingNotification(MonitorOnCheck); in private for form type definition procedure WMPowerBroadcast(var msg: TMessage); message WM_POWERBROADCAST; Roy Lambert |
Thu, Mar 24 2016 9:51 AM | Permanent Link |
David | Hi Roy.
Thanks for the fast response. I think your code sample could certainly come in very useful. Many thanks for posting it. I will play around with this. Regards David. Roy Lambert wrote: David On the good news side, whilst I don't know anything to handle the pinging I do know about handling the screen powering off / on since I had a problem with it. You can trap for when the screen goes on / off and stop pinging / reconnect as appropriate I hope what I've posted below is of use and understandable. |
Mon, Mar 28 2016 12:46 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | David,
<< I am having an issue with pinging that I would like some help/advise if anyone can. I have a situation where users log on via a laptop, do some work then close the laptop down without terminating the app. When they open the laptop back up the app is still active and pinging away, but the session on the server has been removed by this time. >> This is the hibernation powering down the network adapter, and there's really nothing you can do about it, apart from telling Windows that you don't want the machine to hibernate while your application is still running. This may or may not be do-able, depending upon your users and how they use the application. I'd link to some more information on this from Stack Overflow, but it's down at the moment. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Tuesday, April 23, 2024 at 08:10 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |