Loopback vs Empty String in OPC Data Client
In the OPC Data Client, is there a difference in specifying an empty string ("") or the loopback address ("127.0.0.1") as the MachineName parameter for the methods that read and write to my OPC Server?
The input to the methods that accept a MachineName argument are simply passed on by the Data Client to the lower level Microsoft COM functions. The difference should be totally negligible.
Note, however, that the precise string (a combination of the MachineName and the server's progId) is used to determine whether a new connection is needed, or an existing connection will be reused. For example, if you call ReadItemValue multiple times for essentially the same server, but once with "" for the MachineName, and second time with "127.0.0.1", we do not know that in the end they are all the same, and there will be possibly two connections made to the OPC Server. Unless this is somehow required, the application should be written in such way that the same MachineName is consistently used.