17:42, EEST
December 6, 2017
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.
10:11, EEST
April 3, 2012
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
12:03, EEST
December 6, 2017
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.
Most Users Ever Online: 1919
Currently Online:
19 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 144
rocket science: 88
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 0
Members: 727
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1529
Posts: 6471
Newest Members:
ellis87832073466, zkxwilliemae, gabriellabachus, Deakin, KTP25Zof, Wojciech Kubala, efrennowell431, wilfredostuart, caitlynfajardo, jeromechubb7Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1032, Jimmy Ni: 26, Matti Siponen: 349, Lusetti: 0
Administrators: admin: 1