ServerInfoEx
Gets status information on clients and servers from a specified component in a multiprocess runtime environment.
When this function is called, the system redirects the call to the process that contains the specified component. If the specified component is in the calling process, the call is not redirected. If the specified component is not one of the servers listed in the sComponent argument description (see below), of if the system cannot find the component from the connected local processes, a hardware alarm is raised.
Syntax
ServerInfoEx(sName, nType, sComponent [, ClusterName] [, ServerName] )
sName:
The name of the client or server, either "Client", "Server", "Alarm", "Trend", or "Report".
nType:
The type of information required (depends on the Name you specify): "Alarm", "Trend", or "Report" name:
0 - Active flag (returns 1 if this is the active server, 0 if an inactive server).
1 - Number of clients attached to this server.
2 - If this client is attached to the primary or standby server for the specified server name. If Name is "Alarm" and if this client is attached to the primary alarm server, the return value is 0. If this client is attached to the standby, the return value is 1.
3 - The status of the client connection to the specified server name. If Name is "Report" and the client is talking to a report server (either primary or standby), the return value is 1. If not, the return value is 0.
Note: If the sComponent is "IOServer" and the sName is "Client", Types 1 and 2 return an empty string, as the concept of primary and standby servers does not apply to IOServers.
"Client" name:
0 - The computer
name, as specified by [LAN]Node
.
1 - The primary server name, as specified in the server configuration forms in Project Editor.
2 - The secondary server name, as specified , as specified in the server configuration forms in Project Editor.
3 - The name of the INI file being used, for example, Citect.INI.
"Server" name:
0 - The server name, as specified in the server configuration forms in Project Editor.
1 - The number of clients attached to this server. This is the total number of Alarm, Trend Report, and I/O server clients.
"<number>":
0 - The name of the server this client is talking to. For example, "Alarm", "Trend", "Report", or "IOServer".
1 - The login name of the client. This may be an empty string if the client has not logged in.
2 - The CitectSCADA computer name of the client computer.
3 - The time the client logged in.
4 - The number of messages received from this client.
5 - The number of messages sent to this client.
6 - If this client has a licence (1) from this server or not (0).
7 - The type of the licence; full licence (0), View-only Client (1), or Control Client (2).
8 - If the client is remote (1) or local (0).
sComponent:
Specifies the component name from which to retrieve the status information:
" "- An empty string causes the function to run on the calling process.
"Alarm" - Redirects the function to the alarm server process.
"Trend" - Redirects the function to the trend server process.
"Report" - Redirects the function to the report server process.
"IOServer" - Redirects the function to the I/O server process.
Note: If sName
is "Client", the function will NOT be redirected to the component
specified by sComponent. Instead, the
function gets information of type nType
from the current client connection to the component specified by
sComponent.
ClusterName:
The name of the cluster that the server belongs to. This is only relevant if:
ServerName:
Specifies the name of the the I/O Server. This parameter is only required if you are running more than one I/O server process from the same cluster on the same computer and need to instruct the system which process to redirect to. The argument is enclosed in quotation marks "".
Return Value
Status information specified by nType.
Related Functions
ServerGetProperty, ServerInfo, ServerIsOnline, ServerReload, ServerRestart
Example
This example gets the server information from the report process.
sSrvInfo=ServerInfoEx("Report",0, "Report");
IF sSrvInfo THEN
! This is a primary report server.
ELSE
! This is a stand-by report server.
END
/* Get and store the names of clients attached to the report server */
iCount = 1;
iClients = ServerInfoEx("Server", 1, "Report");
WHILE iCount <= iClients DO
sName[iCount] = ServerInfoEx(IntToStr(iCount), 2, "Report");
iCount = iCount + 1;
END
See Also