Applies To:
  • CitectSCADA 5.xx
  • CitectHMI 5.xx

Summary:
How can I use the MsgOpen() function in Citect. 

Solution:
The MsgOpen() function can work with two types of names, either server names or client node names.

Please be aware that MsgOpen() does not open a new session, but rather retrieves the handle for an already existing Citect networking session. MsgOpen() will work both in Netbios and a TCPIP sockets based Citect networking architecture.

See below a Page Table Tran table, as seen in the Citect Kernel. The first column ("Name") contains the server names. The second column ("Node") contains the client Node name as set via the [Lan]Node parameter. These are the clients that are connected to this Citect server.

Page Table Tran

Name Node Mode Mode hMsg Cnt
IOA_P CTTrnRep-P Server Remote 0 2
IOA_P CTIOA-P Client Local 2 0
IOA_P CTIOA-P Server Local 1 0
IOA_R Client Remote 1 1
Alarm <listen> Server Remote 2 0
Alarm CTIOA-P Client Local 6 0
Alarm CTIOA-P Server Local 5 0
IOA_P CTWS003 Server Remote 3 3
IOA_P <listen> Server Remote 4 3
IOA_P CTALM-R Server Remote 5 2
IOA_P CTWS004 Server Remote 6 3
IOA_P CTWS001 Server Remote 8 2
IOA_P CTTrnRep-R Server Remote 10 2
IOA_P CTIOA-R Server Remote 11 1
IOA_P CTALM-P Server Remote 13 2
IOA_P CTWS005 Server Remote 14 1

To open a session from a client to a server you need to user the server name, so the name that is listed in the "Name" column in Page Table Tran on the client. That name can be either "Alarm", "Trend", "Report" or a name of an I/O server. So then the syntax is:

    MsgOpen("<server name>",0,0)   //   this opens a session from client to server

To open a session from server to client you can use the client node name, so the name that is listed in the "Node" column in Page Table Tran on the server. So then the syntax is:

    MsgOpen("<node name>",2,0)   //   this opens a session from server to client.

MsgOpen should return a valid number when it is executed successfully. This number can differ from the "hMsg" as seen in Page Table Tran. If a –1 is returned then an error has occurred.

 

Keywords:
 

Attachments