UaSession::connect() blocks indefinetly

Questions regarding the use of the C++ SDK for Server or Client development or integration into customer products ...

Moderator: uasdkcpp

Post Reply
Lost+Found
Hero Member
Hero Member
Posts: 20
Joined: 07 Feb 2013, 11:01

UaSession::connect() blocks indefinetly

Post by Lost+Found »

Hi,

when I try to execute UaSession::connect(...) with sessionSecurityInfo set to default, and no certificate handling (that means no security method etc) it works fine as long as the server supports non encrypted connections. But when I try to connect to a server that requires a certificate, with no certificate handling enabled in the client, the UaSession::connect() blocks indefinetly. Why is that so and how to avoid it. How can I find out if the server URL that i feed to connect() supports not the None security policy before I do a connect. Do I need to make a discovery first or is there a simpler way?

User avatar
Support Team
Hero Member
Hero Member
Posts: 3072
Joined: 18 Mar 2011, 15:09

Re:UaSession::connect() blocks indefinetly

Post by Support Team »

Hello Vladimir,

The example for your question about the right process of getting all information and to prepare everything for a secure connection can be found in
Open project: Examples -> Client Cpp Sample
Open source file: client_cpp_sdk.cpp
You can find all sample code in
- setupSecurity()
- startDiscovery()

Can you enable logging and send the log file to support@unifiedautomation.com.
Based on the log file we can provide you more details about what is blocking the call.

You need to add the following code to the client to create the log file:

Code: Select all

        /* Activate client trace*/
        LibT::initTrace( UaTrace::Data, 10000, 5, "uaclient.log", "sample client");
        LibT::setTraceActive(true);

        /* Set Trace Settings for stack*/
        UaPlatformLayer::changeTraceSettings(OpcUa_True, OPCUA_TRACE_OUTPUT_LEVEL_ALL);
        LibT::setStackTraceActive(true);
Best Regards,
Unified Automation Support Team
Best regards
Unified Automation Support Team

SikaShrestha
Full Member
Full Member
Posts: 5
Joined: 27 Sep 2013, 02:04

Re: UaSession::connect() blocks indefinetly

Post by SikaShrestha »

When i add the given code to create the log file. it is showing error as

1> client_cpp_sdk_tutorial.cpp
1>.\.\client_cpp_sdk_tutorial.cpp(72): error C2653: 'LibT' : is not a class or namespace name
1>.\.\client_cpp_sdk_tutorial.cpp(72): error C2653: 'UaTrace' : is not a class or namespace name
1>.\.\client_cpp_sdk_tutorial.cpp(72): error C2065: 'Data' : undeclared identifier
1>.\.\client_cpp_sdk_tutorial.cpp(72): error C3861: 'initTrace': identifier not found
1>.\.\client_cpp_sdk_tutorial.cpp(73): error C2653: 'LibT' : is not a class or namespace name
1>.\.\client_cpp_sdk_tutorial.cpp(73): error C3861: 'setTraceActive': identifier not found
1>.\.\client_cpp_sdk_tutorial.cpp(77): error C2653: 'LibT' : is not a class or namespace name
1>.\.\client_cpp_sdk_tutorial.cpp(77): error C3861: 'setStackTraceActive': identifier not found

Can you please help me .

Also, connection is established to the OPC UA server by calling UaSession::connect function successfully and creates a secure channel to the server endpoint. it creates and activates an application session in the server application. I want to know the defination of this function UaSession::connect. Actually i want to know what is the communication packet for connection establishment in opc protocol.

I am stuck in connection establishment in opc protocol for a long time and i need to develop opc application without using sdk.
so can you please help me regarding the basic communciation packet required for connection establishment in opc protocol.


Regards,
Sika

User avatar
Support Team
Hero Member
Hero Member
Posts: 3072
Joined: 18 Mar 2011, 15:09

Re: UaSession::connect() blocks indefinetly

Post by Support Team »

Regarding your compiler error it looks like you do not include the required header file:
#include "libtrace.h"

The client and server SDK hides a lot of the complexity of OPC UA. If you want to learn something about protocol details hidden by the SDKs you can either read the OPC UA specification or one of the OPC UA books available. We reference the book we recommend on our website.

Best regards
Support Team

Post Reply