convertersystems / opc-ua-samples

Sample HMIs using OPC Unified Architecture (OPC UA) and Visual Studio.
MIT License
107 stars 43 forks source link

How does the initial reconnect work? #42

Closed ggokka closed 5 years ago

ggokka commented 6 years ago

As if the client start before the server doesn't start. This code works well this condition. What is the machinism?

        this.application = new UaApplicationBuilder()
            .SetApplicationUri($"urn:{Dns.GetHostName()}:Workstation.RobotHmi")
            .SetDirectoryStore(Path.Combine(
                Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
                "Workstation.RobotHmi",
                "pki"))
            .SetIdentity(this.ShowSignInDialog)
            .SetLoggerFactory(this.loggerFactory)
            .AddMappedEndpoints(config)
            .Build();
awcullen commented 6 years ago

Its really quite simplistic. When a subscription requests a channel to an endpoint, a new UaTcpSessionChannel is created and opened. If the open is not successful, the channel is disposed and a new channel is created after 2 seconds delay.