Try OpenEdge Now
skip to main content
Developing AppServer Applications
Programming ABL Client Applications : Disconnecting from an AppServer instance : Disconnecting from a session-managed AppServer
 

Disconnecting from a session-managed AppServer

The following example shows how a client application can disconnect from a session-managed AppServer instance:
DEFINE VARIABLE hAppSrv AS HANDLE  NO-UNDO.
DEFINE VARIABLE lReturn AS LOGICAL NO-UNDO.

CREATE SERVER hAppSrv.
lReturn = hAppSrv:CONNECT("-AppService inventory -S 5162 -H zeus",
                          "SMITH", "STARSHIP").
IF NOT lReturn THEN DO:
  DELETE OBJECT hAppSrv NO-ERROR.
  RETURN ERROR "Failed to connect to Inventory AppServer".
END.
IF ERROR-STATUS:ERROR THEN DO:
  lReturn = hAppSrv:DISCONNECT().
  DELETE OBJECT hAppSrv NO-ERROR.
  RETURN ERROR RETURN-VALUE.
END.
. . .
lReturn = hAppSrv:DISCONNECT().
DELETE OBJECT hAppSrv NO-ERROR.
When the DISCONNECT( ) method executes, the client application disconnects from the AppServer referenced by the hAppSrv handle. When the disconnection request completes, you can send no more remote requests using the disconnected server handle.