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 Current »


 
Returns all available information about the thick EDMclients that are connected to a remote EDMdatabase at the point of time for invocation of this function.
Header:
#include "sdai.h"
Prototype:
EdmiError edmiRemoteWhoIsOn(SdaiUnsignedInt serverContextId,
                             SdaiInteger     *numberOfConnections, 
SdaiWhoIsOnServer *pWhoIsOn,
SdaiInvocationId *edmiInvocationId);
Arguments:

serverContextId

Context identification, from edmiDefineServerContext

numberOfConnections

A variable that will receive the number of thick EDMclients that are connected to the remote _EDMdatabase{_}.

pWhoIsOn

A variable that will receive a pointer to a tEdmiWhoIsOnServer data structure. See the description of this data structure below.
The returned value will be a pointer to a static buffer in _EDMinterface. This buffer may be overwritten by successive_ _EDMinterface_ function calls. Hence, do not release this memory with edmiFree

edmiInvocationId

Currently not used.

The type definition of the tEdmiWhoIsOnServer data structure is done in the sdai.h header file:
typedef struct EDMI_WHO_IS_ON_SERVER {
unsigned int numberOfConnections;
SdaiClientId myClientId;
tEdmiConnection connections[1];
} tEdmiWhoIsOnServer;
 
Description of the tEdmiWhoIsOnServer struct:
 

numberOfConnections

The number of thick EDMclients that were connected to a remote EDMdatabase at the point of time when edmiRemoteWhoIsOn function was invoked. This value will also be returned in the functions <numberOfConnections> argument.

myClientId

The numeric clientId that identifies the connected thick EDMclient that invoked the edmiRemoteWhoIsOn operation.
If the server context specifies TCP or HTTP communication type, this value will be the clientId of the EDMapplicationServer process that executed the operation on my thin EDMclients behalf.
If the server context specifies LOCAL_DB or LOCAL_CONTEXT communication type, this will be the clientId of my own thick EDMclients stateful connection to the EDMserver

connections

A pointer to a buffer of tEdmiConnection data structures. There will be one element for each connected thick EDMclient in the remote EDMdatabase. See the description of this data stucture below.

 
The type definition of the tEdmiConnection data structure is done in the sdai.h header file:
typedef struct EDMI_CONNECTION {
unsigned int clientIndex;
SdaiClientId clientId;
InstanceId groupId;
EdmiPackedDate connectionTime;
} tEdmiConnection;
 
Description of the tEdmiConnection struct:

clientIndex

1 – max named users.

clientId

A numeric clientId that identifies the connection of a thick EDMclient in the remote _EDMdatabase_

userId

The userId of the EDMuser account that connected to the remote _EDMdatabase._

groupId

The groupId of the EDMgroup account that was used by the EDMuser when connecting to the remote _EDMdatabase._

connectionTime

The date and point of time at which the EDMuser connected to the actual EDMserver.

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:
/* Close the model 'MyModel' on all
the application servers running  
on host 'tellus' */ 
int i;
EdmiError rstat;
SdaiServerContext suContext;
tEdmiWhoIsOnServer *pWhoIsOn;
tEdmiConnection *connect;
SdaiClientId appServer[128], *pAppServer = &appServer[0];
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); 
 
/* Find the client ids of all application
servers running on host tellus */ 
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") && 
! strcmp(hostName, "tellus") ) { 
rstat = edmiRemoteCloseModel(suContext, "MyRepository", "MyModel", 
"xfx56kl9", connect->clientId, 0, NULL); 

edmiFree(hostName); 
edmiFree(clientName); 
}
. . .

  • No labels