Closed Rahul14189 closed 5 months ago
The OpenOPC.open_client call connects to the OpenOPC Gateway service and allows OPC communication across a network. The Gateway service needs to be listening on a TCPv4 port which can be checked by running netstat on the command prompt. The Gateway service listening address is normally set to the IP address of the computer with the environment variable OPC_GATE_HOST instead of using localhost.
The error above seems to indicate that the Gateway service is not running or listening on a localhost address. To connect to the Kepware server directly use OpenOPC.client instead on the local machine.
Thanks @j3mg for the quick reply, sorry i saw it late!! I am able to make connection locally (i.e. when server and client both are on same machine), using OpenOPC.client.
But my use case is, that Kepware server will be on different machine and client will be on non-window machine. In this case, i am continuously getting error.
I have downgraded the python version and then at client side, i checked-out https://github.com/sightmachine/OpenOPC repository, this is based on python 2.7 version at server side machine, i have downloaded the source file from https://sourceforge.net/projects/openopc/files/latest/download and have installed by selecting only server related service. I installed the gateway service using OpenOPCService.exe -install and started it. This is working fine in my case.
But i have to use latest updated version of python, and in this case when i kept the gateway service at Kepware server side machine same as it is in above case. And at client side i am using latest version of python, and have installed OpenOPC-DA and pyro5 i am getting the following error:
Please correct me, if i am wrong, the error suggests that there is mismatch in Pyro version at server and client side machine, i tried to install latest pyro5 at server side machine to matchup with the library version, but it still throws the same error
So i have two questions:
I went through the documentation and found the instruction as,
I followed this, but these commands are not executable, i am making some mistake!!
I am trying to access through opc = OpenOPC.open_client('12.41.0.89'). For all client side environment, i have used linux based OS from docker.
Any suggestions or guide will be highly helpful !!
The server and client must have the same version of Pyro such as version 5 in OpenOPC-DA. The gateway service must be removed, eg OpenOPCService -remove, before installing a different gateway service otherwise the old gateway service might still run. The console apps, opc and opc-service, are installed when the OpenOPC-DA package is installed from pypi. I recommend creating a Python 32 bit virtual environment on the server then install OpenOPC-DA with: pip install OpenOPC-DA Then copy the dlls and install the service as per the readme documentation.
@j3mg , Thanks for the reply,
I tried multiple scenarios, i am able to establish connection by running OpenOPCService.py in debug mode, and also in --foreforward. But when i start the OpenOPCService using start command, it shows "Starting service zzzOpenOPCService" and i am able to connect using telnet but client side throws error stating, here the port shown is 0.0.0.0 which is done by library itself, the actual ip, i used was different
i am able to connect in debug mode, but it does not work in start mode
The stack trace above is from a Pyro4 version of OpenOPC so my advice is limited. It’s likely you have not set OPC_GATE_HOST so will revert to 0.0.0.0 When installing the OpenOPC service make sure the command prompt is running in Administrator mode. Once the service is set up to listen on the correct address, check that the service is listening on the correct address and port with the netstat command.
I believe the error 5 is related to DCOM hardening issue by MS. MS changed default authentication to RPC_C_AUTHN_LEVEL_PKT_INTEGRITY which affects a lot of open source projects, like this one in Java.
You mentioned Kepware server runs in Windows, but client runs in a non-Windows environment. For this reason, you really should check this out, since it provides exactly what you are looking for - no worry about DCOM, cross-platform, Python/JavaScript support etc. Cheers!
Hi,
Thanks for the updated python version of OpenOPC,
I tried to establish connection using Kepware simulated server but i am unable to establish the connection. The error that i receive is,
I have tried to establish the connection using below code, import OpenOPC opc = OpenOPC.open_client('localhost')
I have tried connect method as well, it gives False,
Have i missed anything in code or any setting at the Kepware Simulator Server !!