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
MathWorks Support Team 2024년 9월 13일
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개)

카테고리

Help CenterFile Exchange에서 Unified Architecture에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by