I tried to embed some clients function into servers (in my node manager, in the OpcServer class and in main function), because i need server-to-server communication, but I have compiling errors like this:
\"error C2512: 'UaClientSdk::UaSession' : no appropriate default constructor available\".
I don't know if it's possible what I tried to do (now I resolved with separate applications), if not it will be very interesting.
Embedding an OPC-UA Client into an OPC-UA Server
Moderator: Support Team
-
- Full Member
- Posts: 7
- Joined: 28 Jul 2011, 18:04
Embedding an OPC-UA Client into an OPC-UA Server
Last edited by JtR on 07 Feb 2013, 10:48, edited 1 time in total.
- Support Team
- Hero Member
- Posts: 3071
- Joined: 18 Mar 2011, 15:09
Re:Embedding an OPC-UA Client into an OPC-UA Server
There is no known problem or missing feature when you combine the C++ client and server SKD in one application.
We do that in the UaGateway product and also several users of the C++ SDK are doing that in their applications.
I am not sure why you want to use the client client functions in the main function and in the OpcServer class. I think your problem is comming from this side since the UaModule is used in the OpcServer class and the UaModule has files with the same name but in another directory.
There should be no problem if you encapsulate your client functionality in a seperate class.
Best Regards,
Unified Automation Support Team
We do that in the UaGateway product and also several users of the C++ SDK are doing that in their applications.
I am not sure why you want to use the client client functions in the main function and in the OpcServer class. I think your problem is comming from this side since the UaModule is used in the OpcServer class and the UaModule has files with the same name but in another directory.
There should be no problem if you encapsulate your client functionality in a seperate class.
Best Regards,
Unified Automation Support Team
Last edited by Support Team on 07 Feb 2013, 10:48, edited 1 time in total.
Best regards
Unified Automation Support Team
Unified Automation Support Team
-
- Full Member
- Posts: 7
- Joined: 28 Jul 2011, 18:04
Re:Embedding an OPC-UA Client into an OPC-UA Server
I need to implement server to server communication
- Support Team
- Hero Member
- Posts: 3071
- Joined: 18 Mar 2011, 15:09
Re:Embedding an OPC-UA Client into an OPC-UA Server
There is no need to integrate the client into the OpcServer object or the main function for the Server to Server communication.
If you want to provide configuration and diagnostic information for the Server to Server communication, you can integrate this functionality including the Server to Server communication into a NodeManager. The NodeManager is loaded like any other NodeManager. You can then create a private data class for the NodeManager that has the Client SDK members or you are using a connection management class for the client connection. It is just important that you are not including the client SDK headers in the header file of the NodeManager that is then included for the main function. See sample code below.
If you want to have the Server to Server communication outside a NodeManager, you can do the same with a connection handling class using a private data class that has the client SDK connection.
Best Regards,
Unified Automation Support Team
nodemanagerclient.h
nodemanagerclient.cpp
If you want to provide configuration and diagnostic information for the Server to Server communication, you can integrate this functionality including the Server to Server communication into a NodeManager. The NodeManager is loaded like any other NodeManager. You can then create a private data class for the NodeManager that has the Client SDK members or you are using a connection management class for the client connection. It is just important that you are not including the client SDK headers in the header file of the NodeManager that is then included for the main function. See sample code below.
If you want to have the Server to Server communication outside a NodeManager, you can do the same with a connection handling class using a private data class that has the client SDK connection.
Best Regards,
Unified Automation Support Team
nodemanagerclient.h
Code: Select all
class NodeManagerClientPrivate;
class NodeManagerClient: public NodeManager
{
public:
NodeManagerClient();
virtual ~NodeManagerClient();
// NodeManager functions
private:
NodeManagerClientPrivate* d;
};
Code: Select all
#include "nodemanagerclient.h"
#include "uaclientuasession.h"
class NodeManagerClientPrivate
{
public:
NodeManagerClientPrivate(){}
virtual ~NodeManagerClientPrivate(){}
UaClientSdk::UaSession* m_pSession;
// Other members
};
NodeManagerClient::NodeManagerClient()
{
d = new NodeManagerClientPrivate;
}
NodeManagerClient::~NodeManagerClient()
{
delete d;
}
Best regards
Unified Automation Support Team
Unified Automation Support Team
-
- Jr. Member
- Posts: 3
- Joined: 24 Aug 2016, 10:38
Re: Embedding an OPC-UA Client into an OPC-UA Server
I have the same issue and would like to get some suggestion.
I would like to have a SDK (Server & Client) in one library and from my application choose whether i want to use Server or Client at runtime based on user's settings.
When i tried to include Server and Client files, i got the same error
error C2512: 'UaClientSdk::UaSession' : no appropriate default constructor available\".
In addition, is it possible to use Server and Client in the same target from same application? (As a gateway)
I would like to have a SDK (Server & Client) in one library and from my application choose whether i want to use Server or Client at runtime based on user's settings.
When i tried to include Server and Client files, i got the same error
error C2512: 'UaClientSdk::UaSession' : no appropriate default constructor available\".
In addition, is it possible to use Server and Client in the same target from same application? (As a gateway)