Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »


 
Returns the client name and the name of the host that runs a thick EDMclient process identified by its clientId. The clientIds represent thick EDMclient processes that are statefully connected to an EDMdatabaseServer. Such processes may be the EDMapplicationServer processes of the EDMserver or any other application that is connected to the EDMserver by means of an embedded thick EDMclient.
Related functions:
Header:
#include "sdai.h"
Prototype:
EdmiError edmiRemoteGetClientNames (SdaiServerContext serverContextId,
                                     SdaiClientId      clientId, 
                                     SdaiString        *hostName, 
                                     SdaiString        *clientName,
                                     SdaiInvocationId  *edmiInvocationId);
 
Arguments:

serverContextId

Context identification, from edmiDefineServerContext

clientId

The clientId that identifies the connected EDMclient on the EDMserver. A client Id may be obtained by browsing the result from the function edmiRemoteWhoIsOn

hostName

A variable that will receive name of the host that runs the connected EDMclient process with the given clientId.

clientName

A variable that will receive the optional name that has been assigned to the client process.

edmiInvocationId

Currently not used.

Returns:
A completion code of datatype EdmiError is the returned function value. The completion code has the following values:
Completion code = 0 : Operation successfully performed.
Completion code != 0: Error in operation. Completion code is an _EDMinterface_ error code. Use edmiGetErrorText to get the error text corresponding to the error code.
Example:
/* Check that the EDMserver have at
between 5 and 10 application servers available. 
Return a user defined error message if 
they are to few or to many */ 
 
#define S_ETOFEWAPPSERVERS FIRST_USER_DEFINED_ERROR_CODE
#define S_ETOMANYAPPSERVERS (FIRST_USER_DEFINED_ERROR_CODE + 1)
int i;
EdmiError rstat;
SdaiServerContext suContext;
tEdmiWhoIsOnServer *pWhoIsOn;
tEdmiConnection *connect;
SdaiInteger nConnect, nAppServer;
SdaiString hostName, clientName;
 
/* Define Remote Server Context
for the superuser */ 
rstat = edmiDefineServerContext("SuperUserContext",
"superuser", NULL, "xfx56kl9",
"TCP", "9090", "MyServerHost",
NULL, NULL, NULL, NULL, NULL, &suContext); 
 
/* Define the error code and message */
rstat = edmiRemoteDefineErrorCode(suContext, S_ETOFEWAPPSERVERS,
"To few application servers", REPLACE_EXISTING, NULL); 
 
rstat = edmiRemoteDefineErrorCode(suContext, S_ETOMANYAPPSERVERS,
"To many application servers", REPLACE_EXISTING, NULL); 
 
/* Find all application server client Ids */
rstat = edmiRemoteWhoIsOn(suContext, &nConnect, &pWhoIsOn, NULL);
connect = pWhoIsOn->connections;
nAppServer = 0;
for (i=0;i<nConnect;i++) {
rstat = edmiRemoteGetClientNames(suContext, connect->clientId,
&hostName, &clientName, NULL); 
if (strstr(clientName, "EDMapplicationServer-") && 
strstr(clientName, " Main Client") ) { 
if (++nAppServer > 10) { 
rstat = S_ETOMANYAPPSERVERS; 
break; 


edmiFree(hostName); 
edmiFree(clientName); 
}
if (nAppServer < 5) {
rstat = S_ETOFEWAPPSERVERS; 
}
 
if (rstat) {
SdaiString _errMsg; 
edmiRemoteGetErrorText(suContext, rstat, &_errMsg, NULL); 
printf("\nError %d : %s", rstat, _errMsg); 
}
. . .

  • No labels