Closed panter-dsd closed 5 years ago
Hi @panter-dsd sorry that you ran into trouble. We have this code running successfully with multiple remote hosts. Can you double-check that the ProgId and IP address are correct for your case? If you print out some more debug-related information by adding "opc.Debug()" before the opc.NewConnection call, we might get a better understanding where the problem lies. Thanks!
Thank you for your answer! Yes, I rechecked and all correct. I didn't know about Debug, so:
2019/05/01 11:13:06 Could not load OPC Automation object with wrapper OPC.Automation.1
2019/05/01 11:13:06 Loaded OPC Automation object with wrapper Graybox.OPC.DAWrapper.1
2019/05/01 11:13:06 Connecting to Prosys.OPC.Service on node 192.168.7.51
2019/05/01 11:13:06 Connection failed.
panic: TryConnect was not successful: Connection failed
I just did some testing with the Prosys OPC Simulation server and I could reproduce your error:
2019/05/01 20:47:20 Loaded OPC Automation object with wrapper Graybox.OPC.DAWrapper.1
2019/05/01 20:47:20 Connecting to Prosys.OPC.Service on node localhost
2019/05/01 20:47:20 Connection failed.
panic: TryConnect was not successful: Connection failed
The solution is to set GOARCH to 386 before compiling your code, i.e. in Powershell enter: $ENV:GOARCH=386
With this, it does what it should:
2019/05/01 20:47:48 Loaded OPC Automation object with wrapper Graybox.OPC.DAWrapper.1
2019/05/01 20:47:48 Connecting to Prosys.OPC.Service on node localhost
2019/05/01 20:47:48 Connected.
map[Random.PsFloat1:92.0137066859752]
I tested it on my local machine but it should work remotely as well. I think it's a 32/64 issue somewhere between the OPC component/server apps.
I hope this solves your problem as well.
I right understood - if the server 32 then I can't connect with client 64?
I think this is correct. Did it work for you with the 32 code?
No. But maybe the problem in gbda_aut.dll (it 64 bit) I will try tomorrow on 32 bit machine and write result here.
Ok, thanks. Looking forward to hearing your results! Alternatively, Graybox offers a 32 or 64 OPC wrapper (http://www.gray-box.net/download_daawrapper.php?lang=en) Just copy the files (gbda_aut.dll) in the corresponding directories on your system:
$ENV:GOARCH="amd64"
$ENV:GOARCH="386"
And register the module with regsvr32 gbda_aut.dll
in the command line.
(To remove Graybox OPC Automation Wrapper from your system's registry enter regsvr32 gbda_aut.dll -u.
)
Sure. I know about the procedure of installing gdba_aut. Thanks!
Doesn't work.
For example, with local Matrikon server it works.
Ok, we're making some progress here; at least you can access the Matrikon server locally. Can you try to access the Matrikon server running on your remote host (192.168.7.51) as well?
I tested the Prosys OPC service with the Graybox Wrapper on a remote machine and it works as expected:
2019/05/02 17:10:26 Loaded OPC Automation object with wrapper Graybox.OPC.DAWrapper.1
2019/05/02 17:10:26 Connecting to Prosys.OPC.Service on node 10.100.100.81
2019/05/02 17:10:26 Connected.
map[Random.PsFloat1:67.02508991584182]
I found that it is crucial to compile the golang code with GOARCH=386 and to make sure that the x86 Graybox Wrapper is properly installed and registered.
Can I provide some more information? What's can help?
Maybe you can double-check your DCOM settings as well? The problem doesn't seem to be with the code itself and more with your system setup/configuration since I could verify that the graybox wrapper works with the prosys server and your matrikon example works locally.
@panter-dsd May I ask how to solved this problem finally ? Cause I 've got the very same issue. thx
Sorry, I haven’t touched this this project since 2019. So, I remember nothing about this problem.
I trying to connect to the remote server.
And I get a panic:
What I was doing wrong? Matrikon Explorer works with this server.