Kbase 20929: How to Check for a Real Connection With the AppServer
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  16/10/2008 |
|
SUMMARY:
A failure of the connection between the client and the Progress AppServer can fail due to a variety of reasons, for example, the failure or termination of the server application or the disruption of the network between the client and the server application.
Despite the lack of physical or real connection between the client and the AppServer, the AppServer handle might appear to be still valid when the client application checks its validity using the VALID-HANDLE(hAppServerHandle) function.
Moreover, even the server object method:
hAppServerHandle:CONNECTED()
might still return TRUE in similar circumstances despite the fact that the real connection between the server and the client has actually been lost. The reasons for why the VALID-HANDLE function and the CONNECTED() method return erroneous information in these circumstances are varied and are beyond the scope of this solution.
This solution offers a way to detect whether there is a real physical connection between the client and the AppServer. The assumption here is that if there is a real connection, you want to run some code on the AppServer or take some other action.
SOLUTION:
Follow these steps to detect whether or not there is a real physical connection between the client and AppServer:
1) Write a dummy.p remote procedure on the server that does
nothing at all.
2) In the client application, write a statement to run the remote
dummy.p procedure with the NO-ERROR option:
RUN dummy.p ON SERVER hAppServerHandle NO-ERROR.
3) In the client application, check the ERROR-STATUS:ERROR
attribute, or even better, both the ERROR-STATUS:ERROR and the ERROR-STATUS:NUM-MESSAGES.
If the ERROR-STATUS:ERROR attribute returns TRUE OR the
ERROR-STATUS:NUM-MESSAGES returns a value greater than zero, then your connection to the AppServer is lost and you might want to take some appropriate action.
If the ERROR-STATUS:ERROR attribute returns FALSE AND the
ERROR-STATUS:NUM-MESSAGES returns zero then there is a real connection with the AppServer, and you may proceed with your normal processing.
NOTE: The notes following the description of the ERROR-STATUS system handle in the Progress Language Reference Manual, state that some errors might occur without raising the ERROR condition.
Therefore, in Step (3), it might be more reliable to check the
ERROR-STATUS:NUM-MESSAGES attribute, that returns the total
number of errors that occurred rather than the ERROR-STATUS:ERROR
attribute.
The following error:
Error 5451 SERVER <name> is not connected. (5451)
is commonly associated with the absence of a real connection between a client and an AppServer. This error might still occur when a client application tries to run a remote procedure despite the fact that both the VALID-HANDLE(hAppServerHandle) function and the AppServerHanlde:CONNECTED() return TRUE to the client application.