In designing the agent, you should consider whether or not to check for the existence of a running RGS
Sender service as an indication of a sufficient primary user connection. If service restarts are programmed for
your environment, this test may be unnecessary.
To set the RGS Sender service for automatic restart, you must adjust its Recovery Property through the
Administrative Tools and Services control panel options.
Actions to take for the first failure, second failure, and subsequent failures are available in the properties
menu. The Recovery options include:
●
Take No Action
●
Restart the Service
●
Run a Program
●
Restart the Computer
Microsoft Remote Desktop Recovery
If the RGS Sender becomes unavailable and the RGS Receiver can no longer connect to the RGS Sender, a
Windows system with Remote Desktop services enabled can access the remote computer to diagnose the
issue.
Sample agent
The following sample Windows agent monitors the HPRemote event log and interprets its events. Comments
are included in the agent code showing where additional code would be added to determine if the number of
primary users has dropped to zero. If so, further code can be added to terminate applications on the remote
computer.
The sample code is a fixed-polling Windows agent that reads and interprets the HPRemote event log. The
agent uses two functions:
1.
processEvent(eventServer, eventSource, dwEventNum)
●
open event log, read event dwEventNum, close event log
●
if a valid read, process recognized EventIDs, then return
2.
monitorEvents(eventServer, eventSource, seconds)
●
for a finite number of seconds (or infinite if seconds <= 0) do
●
open event log, read log length, close event log
●
if log has changed, processEvent(), else sleep for X ms.
To properly use the function monitorEvents(...), the following strings must be defined in the function
call:
●
LPCTSTR eventServer: if string is defined as "\\\\yourservername", then the log is stored on a
remote server - if the string is empty (NULL), then the log is stored locally (note that four backlashes
compiles to two in a string constant)
●
LPCTSTR eventSource: the name of the target event generator, e.g., rgreceiver
The sample agent uses Microsoft event logging functions such as OpenEventLog, ReadEventLog, and
CloseEventLog.
The sample agent is listed below. Where noted, user-specific code should be added. The agent header file,
RGSenderEvents.h, is installed with the RGS Sender and is located at:
Remote application termination 71
Komentáře k této Příručce