Connecting from ubuntu client

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

Moderator: uasdkcpp

Post Reply
pstreef
Jr. Member
Jr. Member
Posts: 2
Joined: 31 May 2013, 09:00

Connecting from ubuntu client

Post by pstreef »

I'm quite new to OPC, and I am trying to get my first connection to a test server (setup on a virtual machine by someone else).
I've tested the sdk locally (on the virtual machine) and i can discover my server. Using the "client_cpp_sdk" app and trying "discovery".
I've testen the sdk on the laptop on which the vm is running and i can discover .
I've tested the sdk on a different windows laptop on the network and i can discover.
Now i'm trying to do the same from my ubuntu 12.10 desktop, but i get the following error:

Code: Select all

** Call findServers and getEndpoints for each Server
** Error: UaDiscovery::findServers failed [ret=0x80050000] *********
I can ping to the server ip, and telnet to the server ip + port

my inifile is the same as on my windows laptops:

Code: Select all

[UaClientConfig]
DiscoveryURL =opc.tcp://192.168.1.107:4845
ServerUrl    =opc.tcp://192.168.1.107:4845
CertificateTrustListLocation      =[ApplicationPath]/PKI/CA/certs
CertificateRevocationListLocation =[ApplicationPath]/PKI/CA/crl/uaclientcpp.crl
ClientCertificate                 =[ApplicationPath]/PKI/CA/certs/uaclientcpp.der
ClientPrivateKey                  =[ApplicationPath]/PKI/CA/private/uaclientcpp.pem
UseWindowsStore                   =0
WindowsStoreLocation              =CURRENT_USER
WindowsStoreName                  =UnifiedAutomationUaClientCPP
WindowsClientCertificateThumbprint=x
NS1/Method01      =AirConditioner_2.Stop
NS1/NameSpaceUri  =MyUaServer/BuildingAutomation
NS1/Object01      =AirConditioner_2
NS1/Variable01    =AirConditioner_5.Temperature
NS1/Variable02    =AirConditioner_5.Temperature
NS1/Variable03    =AirConditioner_5.Temperature
NS1/Variable04    =AirConditioner_5.Temperature
NS1/Variable05    =AirConditioner_5.Temperature
NS1/Variable06    =AirConditioner_5.Temperature
NS1/Variable07    =AirConditioner_5.Temperature
NS1/Variable08    =AirConditioner_5.Temperature
NS1/Variable09    =AirConditioner_5.Temperature
NS1/WriteVar01    =AirConditioner_2.TemperatureSetPoint
NS2/Method01      =MyDemoObject.SetAllValues
NS2/NameSpaceUri  =DemoNodeManager
NS2/Object01      =MyDemoObject
NS2/Variable01    =Counter1
NS2/Variable02    =Counter2
NS2/Variable03    =AllDataTypesDynamic/ItemDouble
NS2/Variable04    =AllDataTypesDynamic/ItemFloat
NS2/Variable05    =AllDataTypesDynamic/ItemInt32
NS2/Variable06    =AllDataTypesDynamic/ItemString
NS2/Variable07    =AllDataTypesDynamic/ItemUInt16
NS2/Variable08    =AllDataTypesDynamic/ItemUInt32
NS2/Variable09    =AllDataTypesDynamic/ItemUInt64
NS2/WriteVar01    =AllDataTypesDynamic/ItemDouble
Does anyone have an idea of what i'm doing wrong here?

edit:

On startup i also get this, which i don't get on the windows pc's

Code: Select all

** setupSecurity failed!
** Could not load Client certificate
** Connect will work only without security
*******************************************************

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

Re: Connecting from ubuntu client

Post by Support Team »

Hi pstreef!

I have some questions to your posting:

- Do you try to connect to the server on Ubuntu from a diferent OS (e.g. Windows)?
- (if so) Have you added the Name and IP address of the Ubuntu in your Windows hosts file?
- Are your servers and clients in the same subnet?
- Have you copied the Client certificate to the Windows Server PKI folder and the Server certificate to the Linux PKI folder?

Please do the following:

1. Start the Client on your Ubuntu (remove the PKI folder first).
2. Start the Server on your Windows PC (remove the PKI folder first).
3. Copy the Client Certificate to the certs folder of the Servers PKI.
4. Copy the Servers cert to the certs folder of the Clients PKI.
5. Try to discover the Server with the Client.
6. Now the connection must be possible if you only use the IP address in the client. If you use the Hostname of the Server, you have to enter the name and the address of the Server into the client side PC hosts file.


Best Regards
Support Team

pstreef
Jr. Member
Jr. Member
Posts: 2
Joined: 31 May 2013, 09:00

Re: Connecting from ubuntu client

Post by pstreef »

After looking at the log files i found it strange that the client tried to connect to 4840 when i specified 4841 in my config files.
after changing the ServerConfig to run on 4840 i can make a connection. I presume this might be a hardcoded value in the linux version of the cliend_cpp_sdk example or something. Anyhow, i can make a connection now, so my current question has been answered.

Since i don't use any security (yet) there was also no need for copying certs around.

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

Re: Connecting from ubuntu client

Post by Support Team »

Hi pstreef!

The connection to port 4840, that you can see in the trace files you sent to us is not the actual connection to the OPC UA server, but the connection to the Discovery Server, which uses the standard port 4840.

Best regards
Support Team

Post Reply