Why do I get a "Check if hostname can be resolved" or "Not enough input arguments" error when connecting to an OPC UA server from MATLAB?

2 次查看(过去 30 天)
When establishing a connection to an OPC UA server, MATLAB shows the following error in R2022b and earlier:
uaclient = opcua('12.34.56.789') Error using strncmpi Not enough input arguments. Error in opc.ua.Client (line 387)             if ~strncmpi(this(tI).Hostname, urlParts.Hostname, numel(this(tI).Hostname)) Error in opcua (line 46) uaObj = opc.ua.Client(varargin{:});
In R2023a and newer:
Could not receive endpoint from URL <...>. Check if hostname can be resolved.

采纳的回答

MathWorks Support Team
This issue happens when hostname to IP conversion doesn't occur in the Windows OS. Try the following steps:
1. Navigate to the following path in your Windows Explorer: C:\Windows\System32\drivers\etc\hosts
2. Open the file "hosts".
3. At the bottom of the file "hosts" where there are no "#" symbols, type in the hostname & IP pair for your server. There should be a space between "hostname" and the IP address. It should look something like this:  
12.34.56.789 hostname.domainname.com
This may help MATLAB locate your server.
4. You can then try calling 'opcua' like this:
client = opcua('12.34.56.789', 63500)
Replacing "12.34.56.789" with your server's IP address.

更多回答(0 个)

标签

尚未输入任何标签。

产品


版本

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by