0

I'm using OpenOPC library to connect to OPC servers. I can successfully write and read from my local Matrikon OPC server but when I try and read from another machine (different host) then I get the error Pyro.errors.ProtocolError: connection failed

My code for connection is here;

import OpenOPC

class OPC_tag_reader:

    opc = OpenOPC.open_client('<remote host>')
    #breaks here!!!!

    def __init__(self):
        print 'connecting to server'
        self.opc.connect('Matrikon.OPC.Simulation.1', '<remote host')

The code does not get to the constructor.

Thanks!

Mark Corrigan
  • 544
  • 2
  • 11
  • 29

1 Answers1

0

OPC uses DCOM for communicating you need to perform the following steps to solve this issue.

Run the DCOM configuration utility by selecting Run from your Windows Start menu and type dcomcnfg.exe click on OK. 2.Expand Component Services, Computers and RightClick on the MyComputer and select Properties

Select the Tab Default Properties and Check the “Enable Distributed COM on this Computer”. The Default Authentication level should be Connect and the Default Impersonation level should be Identify. NOTE: Provide additional security for reference tracking should be unchecked.

Now select the COM Security Tab and under the Access Permissions section click on the Edit Defaults Button, Click on the Add… Button and add the user name (The newly created user name that is exactly same as that of user name on the server). After adding the New user select it and in the box below check the boxes to enable (Allow) Both Local Access and Remote Access.

For initial test purposes include Everyone in the Grant Access list.

On the machine where the server is add OpcEnum.exe to the firewall exception list

On the client machine's fire wall allow port 135 incoming coneciton

Note: For initial testing disable the firewall on both the server and the client .. :)

Note down the user ID and password of the windows user account under which the opc server is running and create the same user name and account on the remote machine (This is to establish trust between the two computers)

Vishweshwar Kapse
  • 921
  • 6
  • 23
  • 43