Using Thin Client is there a way to cause the runtime on the server to exit when the network connection is lost?
When this happens orphan runtimes are left and hold 1 license seat that is not released until the runtime is killed.
In some circumstances, in a Thin Client environment, the client can be unexpectedly disconnected from the server. In order to capture this event, the TC_QUIT_MODE server runtime configuration variable was introduced.
TC_QUIT_MODE passes a numeric value to stdout when a client PC is unexpectedly disconnected. This information can then be used by the operating system to perform any needed additional tasks.
Here is how it is implemented:
REMARKS. This program demonstrates TC_QUIT_MODE implemention
where in a Thin Client environment, unexpected client machine
disconnects can be logged.
ASSIGN TO "EVENTDATA2.TXT"
ORGANIZATION LINE SEQUENTIAL
FILE STATUS ERR-STAT.
01 ERR-REC PIC X(3).
01 WIN-HANDLE USAGE HANDLE OF WINDOW.
01 ERR-STAT PIC XX.
03 PB-1 PUSH-BUTTON, "E&xit"
CANCEL-BUTTON LINE 8 COL 12.
* These variables tell the server runtime how often to check for
* client machine activity, and what value is to be sent to the
* server runtime should the client be disconnected. They can
* also be set in the server runtime configuration file.
SET ENVIRONMENT "TC_CHECK_ALIVE_INTERVAL" to "30".
* This value is sent to the Event-Status data structure
* EVENT-DATA-2 elementary item.
SET ENVIRONMENT "TC_QUIT_MODE" TO "888".
OPEN OUTPUT ERR-FILE.
DISPLAY STANDARD GRAPHICAL WINDOW,
BACKGROUND-LOW LINES 10 SIZE 25
EVENT PROCEDURE SHUT-DOWN.
DISPLAY SCREEN-1 UPON WIN-HANDLE.
* To test, disconnect client PC at this point.
MOVE EVENT-DATA-2 TO ERR-REC.
For additional information regarding these server runtime configuration variables and others, see AcuConnect User's Guide > Chapter 3: Server Configuration > 3.4 Creating a Runtime Configuration File for the Remote Server Component.