Development Topics > Tab() Functions > Tab(-10,x) Functions

ATE Disconnect

? tab(-10, AG_ATEDISCONNECT); chr(127);

The function AG_ATEDISCONNECT (44) allows the application running on the server to force the ATE client to disconnect. Typically this causes the ATE client window to close.

Application Tip

It is generally considered good style if the application program automatically closes the ATE connection when the user exits or aborts from the main menu (or application login dialog). This eliminates the need for users to learn the various ways of performing independent or manual disconnects (which are usually best avoided altogether). However, there are a few guidelines and points to be aware of when adding this function to your application:

• Although A-Shell/Windows will ignore the command, other emulators will just see a foreign ESC sequence. An easy way to test whether the command is supported is to use the AUI_ENVIRONMENT function (which see in the XCALL Reference) and test for the AGF_GUIEXT flag.

• Since the disconnect operation will trigger a SIGHUP signal (same as if the client initiated the disconnection), which in turn will shut down the application, you should perform all your shutdown housecleaning (closing files, etc) before sending the AG_ATEDISCONNECT command.

• For maintenance purposes, it is useful to provide a backdoor around the server-initiated disconnect. (You can base this on the user login, a hidden menu item, a startup switch, etc.)

• To prevent the user from independently or manually disconnecting at an inappropriate time, see Password for Disconnect.