eclipse-4diac / 4diac-forte

Eclipse Public License 2.0
25 stars 29 forks source link

OPC UA local server multicast support is broken #82

Open kumajaya opened 5 months ago

kumajaya commented 5 months ago

Without a modified source code, UaExpert from Unified Automation display: uaexpert-no-patch

diff --git a/src/com/opc_ua/opcua_local_handler.cpp b/src/com/opc_ua/opcua_local_handler.cpp
index d08b9d1..ee8f462 100644
--- a/src/com/opc_ua/opcua_local_handler.cpp
+++ b/src/com/opc_ua/opcua_local_handler.cpp
@@ -165,6 +165,7 @@ void COPC_UA_Local_Handler::configureUAServer(UA_ServerStrings &paServerStrings,
   // hostname will be added by mdns library
   UA_String_clear(&paUaServerConfig.mdnsConfig.mdnsServerName);
   paUaServerConfig.mdnsConfig.mdnsServerName = UA_String_fromChars(paServerStrings.mMdnsServerName.c_str());
+  paUaServerConfig.mdnsEnabled = true;
 #endif //FORTE_COM_OPC_UA_MULTICAST

   UA_String_clear(&paUaServerConfig.customHostname);

With above patch applied, FORTE instance run on port 61499 with OPC UA on port 4840 and another FORTE instance run on port 61500 with OPC UA on port 4841, UaExpert display: uaexpert-patch

With above patch applied, FORTE instance run on port 61500 with OPC UA on port 4841 but without FORTE instance on port 61499 with OPC UA on port 4840, UaExpert display: uaexpert-patch-no-4840 Start official Local Discovery Server service from OPC Foundation will make FORTE to close (crash).

FORTE for win32 target build with Visual Build Tools 2022 - amd64, MSBuild version 17.9.8+b34f75857.

kumajaya commented 5 months ago

Proposed fix as a PR: https://github.com/eclipse-4diac/4diac-forte/pull/75 but someone else with a better knowledge to FORTE OPC UA LDS design need to check it.