No connection to Server

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

Moderator: uasdkcpp

Post Reply
fabian727
Jr. Member
Jr. Member
Posts: 3
Joined: 22 Jun 2018, 10:06

No connection to Server

Post by fabian727 »

Hi @ all,

I downloaded yesterday the Cpp-SDK, built the server "server_cpp_demo" and "lesson01" with eclipse and run it.
The terminal output seems fine.
First it prints the URL: opc.tcp:1270.0.01:4840 (yes I already changed configurations in the config file for being sure there are no firewall and DNS problems)
then it hints for CTRL+C
after this it needs some time and prints the result
that the server is running in demo mode and will be stopping in 60 minutes.

With CTRL+C the server stops, so everything seems fine. Except if I try to connect with the UA Expert I get a badTimeOut. Wireshark does not help in any way. I can see the "hello" message from the Client, but there is no answer in the OpcUa protocol.

I am running on ubuntu 18.04. "nmap -r 127.0.0.1" shows me some open ports, but non of them is 4840 or 48010. (only 21, 139,445, 631, which seems to be for default communication)

Previously I tried the AnsiC sdk, which works fine. Now I need this change to Cpp...
What can I do?

fabian727
Jr. Member
Jr. Member
Posts: 3
Joined: 22 Jun 2018, 10:06

Re: No connection to Server

Post by fabian727 »

netstat -ap tcp though shows me the server running with the open (configured) port 4840 on the localhost

I also created a server with the open62541 project. WIth this server the UA-Expert connects fine

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

Re: No connection to Server

Post by Support Team »

Hello fabian727,

1) open port:
try nmap -p0-65535 to scan all ports. you should then see the open port 4840.

2) maybe wrong address:
note that a machine can have multiple IP Addresses(e.g. 127.0.0.1 and 192.168.0.1 and maybe more) and a hostname (e.g. mymachine).
Now the server configuration defines how to bind the Endpoint. E.g. if you specify 127.0.0.1 and a client tries to connect to 192.168.0.1 (which is also a valid IPAddress of the machine) the connection won't work since the server socket was bind to 127.0.0.1 only.
If you bind to the hostname (that's the default setting in the ServerConfig.xml) the server is listening on all IP Addresses.
Best regards
Unified Automation Support Team

Post Reply