Easiest way to block clients to connect

Questions regarding the use of the C++ SDK for Server or Client development or integration into customer products ...

Moderator: uasdkcpp

Post Reply
Stefan_L_01
Sr. Member
Sr. Member
Posts: 18
Joined: 18 Nov 2016, 20:17

Easiest way to block clients to connect

Post by Stefan_L_01 »

Hi

Can I block Clients to connect and release the blocking at a given time again without shutting down Nodemanager etc.?

For the Moment I seem to be forced to start the Server / NM to be able to build up my Adressspace, but I do not want Clients to connect while this is in Progress.

Regards
Stefan

User avatar
Support Team
Hero Member
Hero Member
Posts: 3072
Joined: 18 Mar 2011, 15:09

Re: Easiest way to block clients to connect

Post by Support Team »

Hello Stefan,

you don't need to restart the server or a NodeManager to modify the AddressSpace. We've put an example in the DemoServer that shows how to dynamically add and remove Nodes during runtime.
See here:
http://documentation.unified-automation ... moServer_7
Best regards
Unified Automation Support Team

Stefan_L_01
Sr. Member
Sr. Member
Posts: 18
Joined: 18 Nov 2016, 20:17

Re: Easiest way to block clients to connect

Post by Stefan_L_01 »

HI
Actually I do quite often modify allready substructures of the adressspace, and I allready created a custom Event for the Client to be informed.
Still at application start, I would prefer to prevent Clients to connects until I created the base structures. Because this can take some time in my application. I don´t want Clients to connect and find "nothing", or even worse maybe only half of my final objects, as they can not now whether this is due to application start on my side or a true error.
And I don´t want to force them reading everything again and again as this is a lot to do on their side also. Creating new structures and so on.
So imagine there will be 2 objects in the adressspace after application start, fix and unchangable, and creating them will take 10sec each on my side for some internal reasons, I don´t want the Client to connect and read the AS before the 2nd one is created.
No way to do so? A simple bool "bAllowConnect" would do right? Existing Connections would continue to persist.
BR
Stefan

User avatar
Support Team
Hero Member
Hero Member
Posts: 3072
Joined: 18 Mar 2011, 15:09

Re: Easiest way to block clients to connect

Post by Support Team »

Hello Stefan,

if you start the Server you should first build up the complete infrastructure and then make the Server available (i.e. open the Endpoints).
When the SDK starts the Server it calls startUp() on each module (e.g. NodeManager).
You could simply start the code to build your infrastructure from within the startUp() method (or afterStartUp if you derive from NodeManagerUaNode). This call to startUp() is blocking - so the Server doesn't open any Endpoint until you finished your work here.
If you want to execute that code independent of a NodeManager you can create your own ServerApplicationModule and add it to the Server instead.
see:
http://documentation.unified-automation ... ation.html
Best regards
Unified Automation Support Team

Post Reply