Summary
OpcApplicationConfiguration.HostnameLabel returns everything before the first . in the hostname:
public string HostnameLabel => _hostname.Contains('.')
? _hostname[.._hostname.IndexOf('.')]
: _hostname;
That is intended to strip a DNS suffix (plc.example.com -> plc), but for an IP address it produces nonsense. With OpcUa:Hostname=10.128.128.14 the server's ApplicationUri becomes urn:OpcPlc:10.
Configuring the hostname as an IP is a normal thing to do when clients connect by IP and endpointMustExist style checks compare the advertised endpoint URL against the one they dialled (this is what the Pico MES hub does).
Suggested fix
Skip the label truncation when the hostname parses as an IPAddress (both v4 and v6), and use the full address in the URI, e.g. urn:OpcPlc:10.128.128.14. Add a unit test for the IP case alongside the existing hostname behaviour.
Summary
OpcApplicationConfiguration.HostnameLabelreturns everything before the first.in the hostname:That is intended to strip a DNS suffix (
plc.example.com->plc), but for an IP address it produces nonsense. WithOpcUa:Hostname=10.128.128.14the server's ApplicationUri becomesurn:OpcPlc:10.Configuring the hostname as an IP is a normal thing to do when clients connect by IP and
endpointMustExiststyle checks compare the advertised endpoint URL against the one they dialled (this is what the Pico MES hub does).Suggested fix
Skip the label truncation when the hostname parses as an
IPAddress(both v4 and v6), and use the full address in the URI, e.g.urn:OpcPlc:10.128.128.14. Add a unit test for the IP case alongside the existing hostname behaviour.