.NET Based OPC UA Client/Server SDK
3.3.0.530
|
The following dialog shows an implementation of the Reverse Connect service. Press the button “Show Code” to display the corresponding code, and the button “Help” to show this documentation page.
This example is similar to Advanced Connect. The connection is not established automatically and requires user interaction.
After session creation the client automatically looks for open server channels on the given URL.
Now the following connection process is nearly the same as a normal forward connect.
Enter the servers endpoint URL into "Server URL". By default, this is the Unified Automation .NET Demo Server running on localhost.
Click on “Get Endpoints” to request a list of available Endpoints from the server. Check the box at “Use Asynchronous Pattern” to call BeginGetEndpoints instead of GetEndpoints.
The server’s response is then displayed as a table at “Get Endpoints Response” (see screenshot below).
Double-click on an entry to display more detailed information for a certain Endpoint.
Select an Endpoint from the list and click on “Connect” to establish a reverse connection. When choosing a secure endpoint, it is necessary that client and server trust each other’s certificate first (as described in in the simple connect example).
If successful, the displayed connection state will switch to “Connected”. Check the box at “Use Asynchronous Pattern” to call BeginReverseConnect instead of ReverseConnect.
The following code only shows differenses to the forward connect. For forward connect examples look Advanced Connect.
Create new session with the URL the server is providing channels at.
Call ReverseConnect with one of the returned endpoints.
A callback (OnConnectCompleted) and user data (session) are passed to BeginReverseConnect. The callback casts the user data and calls End Connect.