In a project I have inherited the UAEndpointDescriptor is like this
"opc.tcp://<computer name>:port"
e.g.""opc.tcp://FORWIN1:4846
The computer has three network cards with IP-addresses in different 'families'
198.168.0.2
198.168.1.24
10.56.69.145
The OPC Server is on the 198.168.1.24
Sometimes when the client is starting it connects to 10.56.69.145 and then we get this error
OPCWorker - OPCClient_MonitoredItemChanged - Exception: OpcLabs.EasyOpc.UA.UAServiceException: OPC-UA service result - Error establishing a connection.
---- SERVICE RESULT ----
StatusCode: {BadTcpInternalError} = 0x80820000 (2156003328)
Description: Error establishing a connection.
-----
StatusCode: {BadTcpInternalError} = 0x80820000 (2156003328)
Description: An unexpected error occurred while connecting to the server.
AdditionalInfo: >>> An unexpected error occurred while connecting to the server.
--- at Opc.Ua.Bindings.TcpAsyncOperation`1.End(Int32 timeout)
--- at Opc.Ua.Bindings.TcpClientChannel.OnConnectOnDemandComplete(Object state)
-----
StatusCode: {Bad} = 0x80000000 (2147483648)
Description: Det gick inte att göra en anslutning eftersom måldatorn aktivt nekade det 10.56.69.145:4846
AdditionalInfo: >>> Det gick inte att göra en anslutning eftersom måldatorn aktivt nekade det 10.56.69.145:4846
--- at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
--- at Opc.Ua.Bindings.TcpMessageSocket.EndConnect(IAsyncResult result)
--- at Opc.Ua.Bindings.TcpClientChannel.OnConnectComplete(IAsyncResult result)
---- REMARKS ----
Some possible causes of this error are that the OPC-UA server is not running, or is not configured to listen on the specified port. Also, the network connection may be broken (cable unplugged?).
Would the best solution be to replace the computer name with the actual IP address that the OPC server is using?