Applies To:
  • CitectSCADA
  • CitectHMI

Summary:
I use callback functions with MsgOpen() on a message session between my Display Client and Alarm Server. This was working nicely until recently when I added the Report Server functionality to my Alarm Server. Now, the callback function is no longer triggered on the client. What could be the problem? 

Solution:
Firstly, let's consider a message session opened between a Citect Alarm Server & Display Client. If you are working with callback functions, then a message session should be opened from both the Server and Client.

The Citect Alarm Server connects to the client using:

hClient = MsgOpen("MyClient", 2, MsgFromClient);

The Client connects to the Alarm Server using:

hAlmSvr = MsgOpen("Alarm", 0, MsgFromAlmSvr);

This will work OK if the Citect Server is configured only as an Alarm Server. A message received at either the Server or Client will trigger the respective callback function correctly.

If you next enable the Report Server function (so now Alarm & Report Server), you will find that the MsgFromAlmSvr() function will no longer be called on the Client, yet MsgFromClient() will still be called when the Citect Server receives a message.

This is because when the Alarm Server opens a message session to the Client using mode 2, it actually connects to the client using an existing message session with the highest number (you can see this in the kernel 'page table tran'). The Report session has the highest number because this is the last connection the Client makes as part of it's startup sequence. (See KB Article Q1406 - What is the startup sequence of Citect?)

The Citect Server is now sending messages using the Client's Report session, whilst the Client has its callback function linked to the Alarm Server message session.

As a workaround, you must now open a second connection from the client to the Report Server using the same callback function. For example:

hAlmSvr = MsgOpen("Alarm", 0, MsgFromAlmSvr);
hRptSvr = MsgOpen("Report", 0, MsgFromAlmSvr);

 

Keywords:
 

Attachments