konimarti / opc

OPC DA client in Golang for monitoring and analyzing process data based on Windows COM.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why I can not find the server in the localhost?

cngobd opened this issue · comments

commented

I have start the IntellutionGateWayOPCServer, and my IntellutionGateWayOPCClient can find this OPCDAServer. But I can not find this server by running the follow code:
opc.Debug()
servers_found := opc.NewAutomationObject().GetOPCServers("localhost")
fmt.Printf("Found %d server(s) on '%s':\n", len(servers_found), "localhost")

the result is:
API server listening at: 127.0.0.1:54240
2019/07/15 11:08:50 Could not load OPC Automation object with wrapper OPC.Automation.1
2019/07/15 11:08:50 Loaded OPC Automation object with wrapper Graybox.OPC.DAWrapper.1
Found 0 server(s) on 'localhost':
2019/07/15 11:08:50 GetOPCServers call failed.

How to deal with it?
thank you !

I have never tested the code with IntellutionGateWayOPCServer but it works with most others OPC DA servers. The most common problem is to compile Golang in 64bit when the server is actually 32bit. See also here. Did you try to compile the code with GOARCH=386 (in Powershell: $ENV:GOARCH=386)? Hope this helps.

commented

@konimarti
Thank you for your help
I tried this method,I find that if I list the server with command"localhost",it can not find any server, but if I use my computer name "DESKTOP-UDUBS4F", it can find one server: GrayBoxSimulator, and it still can not find my IntellutionGateWayOPCServer.
My IntellutionGateWayOPCClient can find both GrayBoxSimulationServer and IntellutionGateWayOPCServer.

commented

@konimarti the returned error : Could not load OPC Automation object with wrapper OPC.Automation.1

@769139671 The OPC automation wrapper is needed in the Windows COM model to communicate with the server. If you have a standard OPC DA server installation with all the OPC components installed, you usually also get the OPC.Automation wrapper. As an alternative, Graybox provides a free automation wrapper. So, if at least one loads, you should be fine.

It also seems that your OPC server is known for not working well with other clients link.

However, you could add your server's OPC automation wrapper to this package if they provide one. Maybe you should reach out to them.

Regarding your computer name, did you also try '127.0.0.1' instead of localhost?

commented

@konimarti I can find the GrayBoxSimulationServer using cmd command of "list DESKTOP-UDUBS4F",but I can not connect to this server.
If I use "127.0.0.1" instead of "DESKTOP-UDUBS4F", none of server can be found

Closes 01ef7ad