Working on a requirement to display the status information of the server( Available or Busy) to the client. 2 approach followed:
- used the facility of server capabilities array to display information. As it is an array, 1st element was made to be the feature of the server and 2nd element, to be the status(Initially- Available). The server config(of the multicast server is changed to max session of 1. When this happens the 2nd element of the capability array is changed as Busy. However, while running the client application(findServersOnNetwork.c from open62541 discovery examples), this is not reflected, as values of the config parameters are taken before the server runs( eg: Available status throughout)
2)Using the same server capabiltity array extension, this time, once a session is established, I unregister the server, change the capability list to Busy and register the server again. But while doing so, i get an error : Multicast DNS name conflict detected: 'Crane Multicast Server-._opcua-tcp._tcp.local.' for type 16
I have attached the log of the LDS of successful deregistration( removal of the record). Yet it shows a conflict. Please let me know what could be the issue here? Inspite of the removal of records, the conflict is not acceptable right?
Reproduction steps: server_multicast.c( from the example section of open62541 stack)
while(running== true){
UA_Server_run_iterate(server, true);
if(count!=1){
if(time(0)>timestamp){
timestamp= time(0) + 3;
int count= getCountValue(); //returns the count of sessions currently
printf("Num: %d\n",count);
caps[0]= UA_String_fromChars("Available");
if(count==1){
//caps[1]= UA_String_fromChars("Busy");
//printf("The server status is: %.*s\n", caps[1]);
if(check==false){
returnValue =Routine_run(server,clientRegister,config,endpointUrl,caps); // to dereg, change caps and register again
printf("The server status is: %.*s\n", returnValue);
check=true;}
else{
continue;
}
}
else{
continue;
}
}
}
else{
continue;
}
}
static UA_String Routine_run(UA_Server *server, UA_Client *clientRegister,UA_ServerConfig *config,char *endpointUrl,UA_String *caps){
UA_StatusCode retval;
retval = UA_Server_unregister_discovery(server, clientRegister);
if(retval != UA_STATUSCODE_GOOD){
UA_LOG_ERROR(UA_Log_Stdout, UA_LOGCATEGORY_SERVER,
"Could not unregister server from discovery server. "
"StatusCode %s", UA_StatusCode_name(retval));}
else{
UA_LOG_ERROR(UA_Log_Stdout, UA_LOGCATEGORY_SERVER,
"Unregistration Successfull. "
"StatusCode %s", UA_StatusCode_name(retval));
}
UA_Server_removeCallback(server, callbackId);
caps[1] = UA_String_fromChars("Busy");
UA_StatusCode retval2= UA_Server_register_discovery(server, clientRegister, NULL);
if(retval2 != UA_STATUSCODE_GOOD){
UA_LOG_ERROR(UA_Log_Stdout, UA_LOGCATEGORY_SERVER,
"Could not register server from discovery server. "
"StatusCode %s", UA_StatusCode_name(retval));
caps[1] = UA_String_fromChars("FAIL");}
else{
UA_LOG_ERROR(UA_Log_Stdout, UA_LOGCATEGORY_SERVER,
"registration Successfull. "
"StatusCode %s", UA_StatusCode_name(retval));
caps[1] = UA_String_fromChars("Busy");
}
return caps[1];
}