Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
ServerUri name resolution on Linux
August 16, 2021
17:42, EEST
Avatar
Predixer
Member
Members
Forum Posts: 8
Member Since:
December 6, 2017
sp_UserOfflineSmall Offline

Hi,
We uses the Java SDK on Windows and Linux. On Linux the methods …
– UaClient.discoverEndpoints()
– UaClient.connect()
… are only able to resolve the hostname specified in the serverUri if there is a specific hostname entry in /etc/hosts. This complicates the network maintainance.

As workarround currently I parse the serverUri and replace the host name with the IP address which I detect via “InetAddress.getByName(host).getHostAddress()” (The method is part of the java.net – package.)

Sample:
“opc.tcp://remote-host.com:53530/OPCUA/SimulationServer” => manual address resolution => “opc.tcp://10.64.23.21:53530/OPCUA/SimulationServer”

Now we have to set a specific OPC UA endpoint and have still the same problem again. Is there a way to enforce the UaClient to resolve hostnames via DNS client?
Or are newer versions of the SDK able to do that?

(On Windows system everything works fine. The problem does not exist.)

Environment:
– Prosys SDK: 4.0.2-808

Thanks in advanced for your answer.

August 17, 2021
10:11, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 983
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

Um, I think we do that, at least indirectly, so it not working is a bit odd. Basically typically if there would be a problem it would be the other way around.

At one point in the connection process we do form ‘new InetSocketAddress(host, port)’. At least what AdoptOpenJDK (8 and 11) happens to do then is internally call ‘InetAddress.getByName(hostname)’. Could you check if these 2 behave differently there?

What java version and vendor you are using? What linux distro and version?

Since the InetAddress.getByName works (and Windows works), this might not be of help, but have you configured a DNS server in the linux side (maybe like https://unix.stackexchange.com/questions/71062/ubuntu-how-to-configure-dns-servers-in-etc-network-interfaces-correctly-for-re, but depends on distro and version)? Since the address is internal (10.x.x.x), does your DNS server resolve that hostname? Though, it would be odd if this would be the solution.

P.S.
I know too little of this yet, but I guess in theory at least the windows machines could have just used netbios https://en.wikipedia.org/wiki/NetBIOS#NetBIOS_name_vs_Internet_host_name

August 18, 2021
12:03, EEST
Avatar
Predixer
Member
Members
Forum Posts: 8
Member Since:
December 6, 2017
sp_UserOfflineSmall Offline

Hi Bjarne,
yes you are right, its a bit odd. Sometimes it works, sometimes not. I did some tests to find out the problem. =>
May be there is an other reason, depending on the OPC UA server and its provided endpoints:

Before the “really” connect the client has to fetch the Endpoints from the OPC UA server and decide which one has to be used. The hostname in the serverUri returned in the EndpointDescription may differ from the initial hostname used to fetch the endpoints. => Therefore in networks with NAT.Routers:
– the Bosch OPC UA client provided with the MTX control seems not to be able to connect an OPC UA server.
– Prosys-Client works within the same network 😉
– UA expert client (I think) asked me if the serverUri of the endpoint should be replaced by the NAT address … and it works too.

If I set the endpoint manually (uaClient.setEndpoint(endpointDescriptions[0]) an its serverUri cannot be resolved, the “really” connection fails.
> “Caused by: java.net.UnknownHostException: swidsOPC-Simulation-Server”
If I replace the hostname in the endpoint with the original hostname used to fetch the endoints it works. This is reproduceable. 😉

I think, I can solve the problem.
Thanks a lot.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online: Manfred Hausmann
22 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

rocket science: 77

Ibrahim: 76

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

fred: 41

Member Stats:

Guest Posters: 0

Members: 681

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1467

Posts: 6261

Newest Members:

graciela2073, sagarchau, elviralangwell4, Donnavek, Eddiefauth, DonaldPooma, fidelduke938316, Jan-Pfizer, DavidROunc, fen.pang@woodside.com

Moderators: Jouni Aro: 1010, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 983, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 26, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 321, Lusetti: 0, Ari-Pekka Soikkeli: 5

Administrators: admin: 1