About reverse connection

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

Moderator: uasdkcpp

Post Reply
xiefeng2286
Jr. Member
Jr. Member
Posts: 2
Joined: 20 Feb 2019, 01:50

About reverse connection

Post by xiefeng2286 »

Dear Support Team:
I'm using the C++ based OPC UA SDK version 1.6.3 , because of the NAT and firewall , I need to use the new function of reverse connection , so do like this:

Server:
1.change the ServerConfig.xml file , add an element for ReverseConnect , such as <Url>opc.tcp://172.21.23.6:31000</Url> (the url of client reverse endpoint is opc.tcp://172.21.23.6:31000 ),the ip and port can be accessed by outside

Client:
1.set the value of bIsReverseConnect and sClientEndpointUrl before connect , such as OpcUa_True and "opc.tcp://172.21.23.6:31000" , the endpointurl is the same as ServerConfig.xml file
2.use beginConnect instead of connect, and the first param of this function need using the peer server's endpoint url,such as "opc.tcp://WIN-9P07670PDLE:48010" , and which must be include the hostname of the server ;

so my question is that I must to obtain the server's endpoint in advance , but in some times , the endpointurl need be dynamic accessed , don't need config in advance,so i do like this:
Firs call startReverseDiscovery of the class UaDiscovery , I'll get a notice on receivedReverseConnect , the inputparam sEndPointUrl is incoming , then start begin to invoke beginConnect .

that is right ?

Thanks

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

Re: About reverse connection

Post by Support Team »

Hello xiefeng2286,

before you can actually call UaSession::beginConnect you need to have some information about the Endpoint - especially for secure connections you need to call GetEndpoints to get the ServerCertificate and the security configuration parameters.
So the sequence is to call startReverseDiscovery, receivedReverseConnect then call getEndpoints with the EndpointUrl you get in receivedReverseConnect.
After that proceed with the beginConnect call as you described.
Best regards
Unified Automation Support Team

Post Reply