I tried to connect to my local OPC UA server with Anonymous and No security, but failed with the following code (0x80ad0000). See the below code:
UA_StatusCode status = UA_STATUSCODE_GOOD;
std::unique_ptr<UA_Client, decltype(&UA_Client_delete)> client(UA_Client_new(), UA_Client_delete);
UA_ClientConfig* cfg = UA_Client_getConfig(client.get());
status = UA_ClientConfig_setDefault(cfg);
//status == UA_STATUSCODE_GOOD;
// Endpoint URL of the Ignition OPC UA server
const char* endpointUrl = "opc.tcp://localhost:62541";
//const char* endpointUrl = "opc.tcp://localhost:62541/discovery";
status = UA_Client_connect(client.get(), endpointUrl);
//status == UA_STATUSCODE_BADDISCONNECT (0x80ad0000)
However, I can use Prosys OPC UA Monitor to connect to my local ignition OPC UA Server. Please help me show me my code problem.
You'll need to provide more information... how about logs from your Client program and from Ignition? Wireshark captures?
Thanks a lot for your fast response. Here is my console output:
I don't know how I can get a log file. Remember I am writing C/C++ codes. The same code works for Prosys OPC UA Simulation Server nicely.
I'm not familiar with the library you're using, but it looks like you're not even getting as far as being able to open a TCP connection to the Ignition server.
I don't know why that would be the case when Prosys client is able to connect without issue. This indicates it's probably not an issue with the Ignition configuration. I assume all of this software (Ignition, prosys, your C++ app) is running locally. Maybe some permissions on your C++ executable or firewall permissions?
I don't think there are permission issues at all because all servers and clients are running locally. I can use the same above code snippet to connect with Prosys OPC UA Simulation Server without any issue at all. I am a very beginner to OPC UA.
Does your company have C/C++ developer to test my code snippet for me?
Here are OPC UA settings:
No. This is your problem to deal with. I can offer assistance with the Ignition and OPC UA aspect.
Those settings look okay. You do need to restart the Gateway for any changes to take effect.
1 Like
Try "127.0.0.1" instead of "localhost" in the endpoint URL you use in your client?
Maybe something funny going on there.
Your banner on your gateway shows trial expired. Don't forget to reset the trial time while testing.
1 Like
I have just reset it. I still get the same errors (UA_STATUSCODE_BADDISCONNECT (0x80ad0000)) with end point url (opc.tcp://localhost:62541):
If I use the end point url (opc.tcp://127.0.0.1:62541), I get the errors (UA_STATUSCODE_BADSERVICEUNSUPPORTED (0x800b0000)).
However, if I use Prosys OPC UA simulation server with the end point url: opc.tcp://ATL-DEV-CY-04.DataManag.local:53530/OPCUA/SimulationServer, I get everything works perfectly.
I am sure your company OPC UA server has a connection flaw because the same code snippet does work with other OPC UA server.
Here is the output for Prosys OPC UA simulation server:
I have already restarted my machine after installing ignition OPC UA server.
Do you have some C/C++ code snippet for me to test it against your Ingnition OPC UA server?
Your ignition OPC UA server refuses (opc.tcp://localhost:62541/discovery or opc.tcp://localhost:62541) directly. However, Prosys OPC UA server is able to select a correct end point url when a client is configured with 'UserTokenType Anonymous and SecurityPolicy Profile Reporting Links'.
It looks like using 127.0.0.1 solved the connection issue and you have a different problem after that.
Wrong! your ignition OPC UA server still has an issue with 127.0.0.1 with error code UA_STATUSCODE_BADSERVICEUNSUPPORTED.
Wrong!
your client has an issue.
It's probably trying to call the CreateSession service against the discovery endpoint at opc.tcp://localhost:62541/discovery
instead of the session endpoint at opc.tcp://localhost:62541
.
Share a Wireshark capture and we'll see.
4 Likes
I just compiled and ran this open62541 example, changing only the endpoint URL, and it connected to the Ignition OPC UA server without issue.
kevin@DV-kevin ~/D/open62541> gcc -std=c99 tutorial_client_firststeps.c -lopen62541 -o client
kevin@DV-kevin ~/D/open62541> ./client
[2025-05-06 08:36:02.159 (UTC-0700)] warn/client Skip verifying ApplicationURI for the SecurityPolicy http://opcfoundation.org/UA/SecurityPolicy#None
[2025-05-06 08:36:02.160 (UTC-0700)] info/network TCP 3 | Opening a connection to "127.0.0.1" on port 62541
[2025-05-06 08:36:02.168 (UTC-0700)] info/channel TCP 3 | SC 2 | SecureChannel opened with SecurityPolicy http://opcfoundation.org/UA/SecurityPolicy#None and a revised lifetime of 600.0s
[2025-05-06 08:36:02.168 (UTC-0700)] info/client Client Status: ChannelState: Open, SessionState: Closed, ConnectStatus: Good
[2025-05-06 08:36:02.171 (UTC-0700)] info/client Use the EndpointURL opc.tcp://127.0.0.1:62541/discovery returned from FindServers and reconnect
[2025-05-06 08:36:02.172 (UTC-0700)] info/channel TCP 3 | SC 2 | SecureChannel closed
[2025-05-06 08:36:02.172 (UTC-0700)] warn/client Skip verifying ApplicationURI for the SecurityPolicy http://opcfoundation.org/UA/SecurityPolicy#None
[2025-05-06 08:36:02.172 (UTC-0700)] info/network TCP 6 | Opening a connection to "127.0.0.1" on port 62541
[2025-05-06 08:36:02.172 (UTC-0700)] info/network TCP 3 | Socket closed
[2025-05-06 08:36:02.179 (UTC-0700)] info/channel TCP 6 | SC 3 | SecureChannel opened with SecurityPolicy http://opcfoundation.org/UA/SecurityPolicy#None and a revised lifetime of 600.0s
[2025-05-06 08:36:02.179 (UTC-0700)] info/client Client Status: ChannelState: Open, SessionState: Closed, ConnectStatus: Good
[2025-05-06 08:36:02.181 (UTC-0700)] warn/client The server returned Endpoints with a different EndpointUrl opc.tcp://127.0.0.1:62541/discovery than was used to initialize the connection: opc.tcp://127.0.0.1:62541/discovery. Some servers require a complete match of the EndpointUrl/DiscoveryUrl (including the path) to return all endpoints.
[2025-05-06 08:36:02.181 (UTC-0700)] info/client Selected endpoint with EndpointUrl opc.tcp://127.0.0.1:62541, SecurityMode None and SecurityPolicy http://opcfoundation.org/UA/SecurityPolicy#None
[2025-05-06 08:36:02.181 (UTC-0700)] info/channel TCP 6 | SC 3 | SecureChannel closed
[2025-05-06 08:36:02.181 (UTC-0700)] warn/client Skip verifying ApplicationURI for the SecurityPolicy http://opcfoundation.org/UA/SecurityPolicy#None
[2025-05-06 08:36:02.181 (UTC-0700)] info/network TCP 3 | Opening a connection to "127.0.0.1" on port 62541
[2025-05-06 08:36:02.181 (UTC-0700)] info/network TCP 6 | Socket closed
[2025-05-06 08:36:02.185 (UTC-0700)] info/channel TCP 3 | SC 4 | SecureChannel opened with SecurityPolicy http://opcfoundation.org/UA/SecurityPolicy#None and a revised lifetime of 600.0s
[2025-05-06 08:36:02.185 (UTC-0700)] info/client Client Status: ChannelState: Open, SessionState: Closed, ConnectStatus: Good
[2025-05-06 08:36:02.246 (UTC-0700)] info/client Client Status: ChannelState: Open, SessionState: Created, ConnectStatus: Good
[2025-05-06 08:36:02.247 (UTC-0700)] info/client Client Status: ChannelState: Open, SessionState: Activated, ConnectStatus: Good
[2025-05-06 08:36:02.254 (UTC-0700)] info/userland date is: 6-5-2025 15:36:2.253
[2025-05-06 08:36:02.258 (UTC-0700)] info/channel TCP 3 | SC 4 | SecureChannel closed
[2025-05-06 08:36:02.258 (UTC-0700)] info/client Client Status: ChannelState: Fresh, SessionState: Closed, ConnectStatus: BadConnectionClosed
[2025-05-06 08:36:02.258 (UTC-0700)] info/network TCP 3 | Socket closed
kevin@DV-kevin ~/D/open62541>
2 Likes
How about windows platform? I am working with Visual C++ 2022 on windows 11 platform. Thanks a lot for your help. Does your company have someone who has some experience with Visual C++ 2022 on window platforms? I have reached the max posts here and I need to wait another 20 hours before posting a new topic.
I still have the max post issue.
Thanks a lot for your help. I moved into a new window machine.
I still have the connection problem. Let me check Ignition Server settings.
I don't have a Windows laptop or even any experience using Visual C++.
1 Like