Cicode Programming Reference > Cicode Function Categories > Server Functions Introduction > 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 CitectSCADA 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

ServerInfo(sName, nType [, ClusterName] )

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.

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

ClusterName:

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

Return Value

Status information specified by nType.

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