ya-mouse / openopc

OpenOPC for Python3.4

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OpenOPC.open_client: ConnectionRefusedError + remote machine running OpenOPC Gateway Service

jamesbraza opened this issue · comments

I have the following set up:

  • On remote machine (10.4.8.71): both MatrikonOPC Simulation Server and the OpenOPC Gateway Service running
  • On local machine: run the below snippet
  • On both machines: Windows OS, Windows Firewall disabled, ran regsvr32 /s \path\to\openopc\lib\gbda_aut.dll
import OpenOPC

opc = OpenOPC.open_client(host="10.4.8.71")

The last line throws the following Pyro4.errors.CommunicationError:

Traceback (most recent call last):
  File "C:\path\to\venv\lib\site-packages\Pyro4\core.py", line 511, in connect_and_handshake
    sock = socketutil.createSocket(connect=connect_location,
  File "C:\path\to\venv\lib\site-packages\Pyro4\socketutil.py", line 307, in createSocket
    sock.connect(connect)
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  ...
  File "C:\path\to\scripts\opc.py", line 25, in matrikon_simulation_main
    opc = OpenOPC.open_client("10.4.8.71")
  File "C:\path\to\venv\lib\site-packages\OpenOPC.py", line 131, in open_client
    return server_obj.create_client()
  File "C:\path\to\venv\lib\site-packages\Pyro4\core.py", line 275, in __getattr__
    self._pyroGetMetadata()
  File "C:\path\to\venv\lib\site-packages\Pyro4\core.py", line 615, in _pyroGetMetadata
    self.__pyroCreateConnection()
  File "C:\path\to\venv\lib\site-packages\Pyro4\core.py", line 596, in __pyroCreateConnection
    connect_and_handshake(conn)
  File "C:\path\to\venv\lib\site-packages\Pyro4\core.py", line 549, in connect_and_handshake
    raise ce
Pyro4.errors.CommunicationError: cannot connect to ('10.4.8.71', 7766): [WinError 10061] No connection could be made because the target machine actively refused it

I am not sure if:

  • I am missing a software entity in the communication pipeline
  • If multi-machine systems doesn't work with OpenOPC
  • If I have an incorrect OS configuration on one or both machines

What can I do to fix this?

@ya-mouse thank you for answering my questions today in #24, it helped me realize I was running the OpenOPC Gateway Service on the wrong machine. Any ideas on this one?