Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Set number of retries for a server trying to connect to a client in reverse connection mode
January 12, 2023
11:29, EET
Avatar
oct
New Member
Members
Forum Posts: 2
Member Since:
January 12, 2023
sp_UserOfflineSmall Offline

Hello, I was wondering if the sdk has the capability to set an opcua server to retry connecting to a client in reverse connection mode, and if that number of retries is configurable. Thank you

January 12, 2023
13:30, EET
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1032
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

Is this a “just a question” or did you observe something that doesn’t seem correct?

The server by the specification (and our implementation) retry infinite times. See https://reference.opcfoundation.org/Core/Part4/v104/docs/6.7 near the end:

OPC 10000-6defines a reverse connect mechanism where the Serverinitiates the logical connection. All subsequent steps like creating a SecureChannelare initiated by the Client. In this scenario the Clientis only able to initiate a reconnect if the Serverinitiates a new logical connection after a connection interruption. The Clientside reconnect handling described in Figure 36applies also to the reverse connect case. A Serveris not able to actively check the connection status; therefore the Servershall initiate a new connection in a configurable interval, even if a connection to the Clientis established. This ensures that an initiated connection is available for the reconnect handling in addition to other scenarios where the Clientneeds more than one connection.

Though, It has been a while since I last looked this, but our implementation is not 1:1 on that yet: the interval cannot be configured and it is more like retrying when opening the connection failed (or a successful opened connection is closed) instead of a real interval. We will probably improve this at some point.

When using https://www.prosysopc.com/products/opc-ua-browser/ + https://www.prosysopc.com/products/opc-ua-simulation-server/, you can make the Browser listen to reverse connections by typing “inv:60000” (i.e. inv:port, 60000 here is just an example), it will then transform the uri to “inv+opc.tcp://YOUR_HOSTNAME_HERE:60000” (you can also type this directly), copy this on Simulation Server (use Options menu to switch to Expert Mode first) Endpoints tab in the Reverse Connections, press apply and restart the SimulationServer. You might need to press connect on Browser again (it will timeout after a while if no connections was opened) you should see the connection being formed after Simulation Server starts. If you then disconnect and connect Browser again, it should be re-formed (and this should work infinite times). Note that Browser accepts the first reverse connection made to this inv+opc.tcp address (i.e. it doesn’t open multiple tabs, we might some day do that as well).

In the SDK, you can add the reverse connections via UaServer.addReverseConnection(…) (read the javadocs, it is important to get the ‘endpointUrlForClientConnection’ parameter right as basically the reverse connection “jump starts” the real connection, this parameter is what the client will give in the Hello message and it must match one it would have given in a non-reverse connection; and note that this is separate from the first ‘clientServerEndpointUrl’ parameter, which is the “inv+opc.tcp://YOUR_HOSTNAME_HERE:60000” using the previous example ).

Let us know if this helped (and if you use this if improvements would be needed and when).

P.S.
In case you wonder why it is infinite, I assume it was specified so because normally servers are not observed actively (no one to press a “reverse connect button” actively) and it cannot be known when the client starts to listen for the connections (because if you need reverse connection there most likely is not a way to connect directly to the server), thus it basically has to be infnite.

January 12, 2023
13:36, EET
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1032
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Also, you can also see sampleconsoleserver (add reverse connection action)
and sampleconsoleclient via ‘-r’ command line argument or seeing code paths where ‘isInReverseConnectionMode’ is true, note that you must also add a “client.setReverseConnectionListener(new MyReverseConnectionListener());” and you should filter the connection (see MyReverseConnectionListener in sampleconsoleclient). Note that this will form a single connection, we do not yet have something that would produce UaClients per each reverse connection to the opened server port (in the client side i.e. the port “60000” in the prev post example). Once the reverse connection listener returns true the serversocket is closed (unless reconnect is needed, then it is opened again) and then things works like as-if a normal connection had been opened.

January 13, 2023
10:09, EET
Avatar
oct
New Member
Members
Forum Posts: 2
Member Since:
January 12, 2023
sp_UserOfflineSmall Offline

Thank you for your very detailed answer. We are exploring a way for:
1. either to configure the number of retry attempts from the server(and also the interval between retries should be configurable)
2. either after sending the ReverseHello from the server, if we get back an error such as “BadTcpMessageTypeInvalid” from the client, the server would try attempting the connection again only after some interval(RejectTimeOut) that would be configurable.

From your answer I understand that:
for 1. RetryInterval, and NumberOfRetries are not configurable.
for 2. the server can stop connecting only by removing the reverse connection entirely and restarting the server(besides the other limitations).

Is my understanding correct?

January 13, 2023
12:47, EET
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1032
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

At the moment yes.
We are aware that this could do some improvements (at least some delay should be made), though not 100% sure when that would happen; the current work has been towards getting 1.05 information model support (and this with our versioning logic will also cause SDK 5.0.0).

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
45 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Heikki Tahvanainen: 402

hbrackel: 144

rocket science: 88

pramanj: 86

Francesco Zambon: 83

Ibrahim: 78

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

Member Stats:

Guest Posters: 0

Members: 726

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1529

Posts: 6471

Newest Members:

gabriellabachus, Deakin, KTP25Zof, Wojciech Kubala, efrennowell431, wilfredostuart, caitlynfajardo, jeromechubb7, franciscagrimwad, adult_gallery

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1032, Jimmy Ni: 26, Matti Siponen: 349, Lusetti: 0

Administrators: admin: 1