How the Client Connects to and Gets Data From a Server

When OPC servers are installed on the system, they are registered so that clients can find them and users can view them in a list. To make a client/server connection, the user must first choose a server. The server name selected is used to get a class ID which, in turn, is used to create a COM object. If the user selects a server that is not currently running, the system starts the server and then creates the object in that server on behalf of the client.

 

Once the COM object is created, the client application has an IOPCServer interface, as defined in the OPC specification. This is the main interface to an OPC server, and this document refers to this as the Server interface. (The other interface is Group.) An OPC client always creates a group in the server and registers an advise interface with it to get asynchronous data notification.

 

When an item is added, the dialog displays either a hierarchy or a flat list of names, depending on the server. The names are queried from the Server object using the filter string and requested data type. When the user either types or selects a name, an item by that name is added to the Group object. This item is also read immediately to get an initial value.

 

Items in a group are scanned by the server; when their values change, the advise interface in the client is notified. A data structure containing the data for each item whose value or quality has changed (and only those items) is passed to the client’s advise interface. The client unpacks and uses the data.

 

See Also:

About Modbus Configurator