Cicode Programming Reference > Cicode Function Categories > Server Functions > ServerInfo

ServerInfo

Gets status information on clients and servers.

Note: This function is a non-blocking function and can only access data contained within the calling process; consequently it cannot return data contained in a different server process. This function is not redirected automatically by Citect SCADA runtime. If you want to make a call from one process to return data in another, use MsgRPC() to make a remote procedure call on the other process. Alternatively, use the ServerInfoEx function that allows you to specify the name of the component from which you want to retrieve data.

Syntax

STRING ServerInfo(STRING Name, INT Type [, STRING ClusterName] )

Name:

The name of the client or server, either "Client", "Server", "Alarm", "Trend", or "Report".

Type:

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).

Note:
Alarm Server: When an alarm server is active, it writes entries to the alarm log device(s). However, this alarm server may not be the 'Main' alarm server. The 'Main' alarm server stores data in the primary archive used for displaying the 'Sequence of Events' and 'Summary' pages. Currently an alarm server may be 'active' for the log devices, but 'standby' for the primary archive.
Trend Server: Trend server redundancy does not have the concept of "active". For trend servers, Type=0 will return 1 if the process is running on the computer defined as "Primary", and zero (0) if the process is running on the machine defined as "Secondary".

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.

4 - Alarm DB Status for the alarm server. Returns 1 if initializing, 2 if main, 3 if standby and 4 if invalid.

"Client" name:

0 - The computer name, as specified by [LAN]Node.

1 - Not supported.

2 - Not supported.

3 - Not supported.

For modes 1,2 and 3, use ServerInfoEx instead.

"Server" name:

0 - Not supported.

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 Citect SCADA 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).

ClusterName:

The name of the cluster that the server belongs to. This is only relevant if:

Return Value

Status information specified by nnType.

Related Functions

ServerGetProperty, ServerInfoEx, ServerIsOnline, ServerReload, ServerRestart

Example

sSrvInfo=ServerInfo("Report",0);
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 this server */
iCount = 0;
iClients = ServerInfo("Server", 1);
WHILE iCount < iClients DO
sName[iCount] = ServerInfo(IntToStr(iCount), 2);
iCount = iCount + 1;
END

See Also

Server Functions

Published June 2018