Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discovery Example #4058

Open
twolff-afk opened this issue Dec 9, 2020 · 10 comments
Open

Discovery Example #4058

twolff-afk opened this issue Dec 9, 2020 · 10 comments
Labels
Component: Server Issues related to the server code Priority: Low Issue with low priority Type: Question General question or code understanding

Comments

@twolff-afk
Copy link

Implementing a Local Discovery Server

I want to implement a local discovery server and have worked on the example in open62541 Discovery Example.

config->mdnsConfig.serverCapabilitiesSize = 1;
This line is from the server_lds.c file and the error message is, that UA_ServerConfig doesn't have a member mdnsConfig

// periodic server register after 10 Minutes, delay first register for 500ms
UA_UInt64 callbackId;
UA_StatusCode retval = UA_Server_addPeriodicServerRegisterCallback(server, clientRegister, DISCOVERY_SERVER_ENDPOINT, 10 * 60 * 1000, 500, &callbackId);
Those four lines are from server_register.c where the server is registered at the LDS. The error message here is: UA_Server_addPeriodicServerRegisterCallback and DISCOVERY_SERVER_ENDPOINT are not defined.

So my question is, where can I find a working LDS example and how can I register my OPC UA Server?

It will help me a lot, if anyone has an idea on how to solve this !!

@RakshanPremsagar
Copy link

If you are using Eclipse for development, make sure you use the open62541.c in the same folder as the src.
Even i am beginning to explore discovery mechanism, i found the LDS to be wokŕking . So may be you could try it

@twolff-afk
Copy link
Author

twolff-afk commented Dec 14, 2020

Hey @RakshanPremsagar,

first of all, thank you for your help!
I am using MS Visual Studio 2019 for development. I put the open62541.c and open62541.h in the src directory of my project and included the header file, but the error message is still the same.

@RakshanPremsagar
Copy link

oh sorry, I am using linux, and I remember getting the same issue.. and it was fixed by adding the open62541.c file to the src folder. The LDS got working

@RakshanPremsagar
Copy link

hey, have you managed to get it working?

@cmbahadir
Copy link

Hello @twolf-afk,

This line is from the server_lds.c file and the error message is, that UA_ServerConfig doesn't have a member mdnsConfig

Well seems like you are missing build arguments for discovery service. Please make sure that you have set these arguments to 'ON' while building open62541.

UA_ENABLE_DISCOVERY
UA_ENABLE_DISCOVERY_MULTICAST
UA_ENABLE_DISCOVERY_SEMAPHORE

Those four lines are from server_register.c where the server is registered at the LDS. The error message here is: UA_Server_addPeriodicServerRegisterCallback and DISCOVERY_SERVER_ENDPOINT are not defined.

Actually, DISCOVERY_SERVER_ENDPOINT is defined in server_register.c here, it is not possible to say something about the error w/o seeing your example code.

But again UA_Server_addPeriodicServerRegisterCallback depends on UA_ENABLE_DISCOVERY argument, so it should go away and you could manage to compile your example if you set the discovery service arguments above.

@RakshanPremsagar
Copy link

Hello @cmbahadir ,
Is the UA_ENABLE_DISCOVERY_SEMAPHORE build option mandatory?

@cmbahadir
Copy link

Hello @RakshanPremsagar

No, as far as i can say its not required if the registration is not managed over semaphore files.

@RakshanPremsagar
Copy link

RakshanPremsagar commented Jan 3, 2021

Hello @cmbahadir ,
I have one query on Discovery mechanism.

I have a lds running(server_lds.c) and then I have another server(multicast.c) running on my system. The multicast server registers with the LDS and everything is fine. When i run the findServersOnNetwork code, I see both the servers.

However, when I close the multicast server, it should get deregistered from the LDS.
But i get a log saying : Could not remove mDNS record for hostname Sample Multicast Server.

I get TXT and PTR entries on the wireshark log as a result.
Could you tell me why does this happen?
I have tried to debug by putting breakpoints on the log statement.. But when doing so, the multicast server does not get registered.
Could you Please tell me why does this happen?

PS: All the codes i mentioned are in the example/discovery section of the stack

@cmbahadir
Copy link

cmbahadir commented Jan 5, 2021

Well, i guess a separate issue with required logs, traces and used version would be better for your problem. Because, it seems like a separate topic.

I am not really familiar with discovery server architecture, so i can't answer your questions directly.

@NoelGraf NoelGraf added Component: Server Issues related to the server code Priority: Low Issue with low priority Type: Question General question or code understanding labels Apr 16, 2021
@jackybek
Copy link
Contributor

The reason for the missing structure member is you forgot to run
git submodule update --init --recursive

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Server Issues related to the server code Priority: Low Issue with low priority Type: Question General question or code understanding
Projects
None yet
Development

No branches or pull requests

5 participants