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
OPC UA connection established only afert second attempt
December 17, 2021
11:31, EET
Avatar
gerstale
Member
Members
Forum Posts: 12
Member Since:
November 26, 2019
sp_UserOfflineSmall Offline

Hello,

during the tests we have recognized that the connection between OPC UA client and server will be established only after second attempt. Both OPC UA server and client based on prosys-opc-ua-sdk-for-java-4.6.2-1636. Could you please explain, what is the reason for this? and how to avoid it?

Server logging:
[OPC-UA-Stack-Non-Blocking-Work-Executor-2] INFO com.prosysopc.ua.stack.transport.tcp.nio.OpcTcpServer – OpcTcpServer(opc.tcp(/172.21.144.1:12686)): /192.168.178.240:10422 connected
[OPC-UA-Stack-Blocking-Work-Executor-1] INFO com.prosysopc.ua.stack.transport.tcp.nio.OpcTcpServerSecureChannel – SecureChannel opened; SecurityToken(Id=1, secureChannelId=1, creationTime=17.12.2021, 10:16:34, lifetime=3600000)
[OPC-UA-Stack-Async-Selector] INFO com.prosysopc.ua.stack.utils.asyncsocket.AsyncSocketImpl – AsyncSocketInputStream.close(): unexpected untriggered monitor
[OPC-UA-Stack-Async-Selector] INFO com.prosysopc.ua.stack.transport.tcp.nio.OpcTcpServerSecureChannel – Secure Channel closed, token=SecurityToken(Id=1, secureChannelId=1, creationTime=17.12.2021, 10:16:34, lifetime=3600000)
[OPC-UA-Stack-Async-Selector] INFO com.prosysopc.ua.stack.transport.endpoint.AbstractServerSecureChannel – Channel closed: Id=1
[OPC-UA-Stack-Non-Blocking-Work-Executor-6] INFO com.prosysopc.ua.stack.transport.tcp.nio.OpcTcpServer – OpcTcpServer(opc.tcp(/172.21.144.1:12686)): /192.168.178.240:10424 connected
[OPC-UA-Stack-Blocking-Work-Executor-4] INFO com.prosysopc.ua.stack.transport.tcp.nio.OpcTcpServerSecureChannel – SecureChannel opened; SecurityToken(Id=1, secureChannelId=2, creationTime=17.12.2021, 10:16:34, lifetime=3600000)
[OPC-UA-Stack-Blocking-Work-Executor-5] INFO com.prosysopc.ua.server.SessionManager – Session created: d77d10c3-b110-4c61-a72e-b188409b3754-48E537BD (ID=ns=1;g=8579f040-0625-4b8a-b2a6-4745708fbf71 Token=b=OA27rqg61gWm2w0bICHgs3Ybro4x6+21+a37eWay/7k= Channel=(SecureChannelId=2 State=Open URL=opc.tcp://192.168.178.22:12686/OPCUA/SampleConsoleServer SecurityPolicy=http://opcfoundation.org/UA/SecurityPolicy#None RemoteAddress=/192.168.178.240:10424))
[OPC-UA-Stack-Blocking-Work-Executor-7] INFO com.prosysopc.ua.samples.server.TestServer – onValidate: userIdentity=Type=Anonymous

Client logging:
[OpcUaClientCommunicationManager_0_opc.tcp://192.168.178.22:12686/OPCUA/SampleConsoleServer_8] INFO com.prosysopc.ua.stack.transport.tcp.io.TcpConnection – /192.168.178.22:12686 Connecting
[OpcUaClientCommunicationManager_0_opc.tcp://192.168.178.22:12686/OPCUA/SampleConsoleServer_8] INFO com.prosysopc.ua.stack.transport.tcp.io.TcpConnection – Connected (non-reverse), handshake completed, local=/192.168.178.240:10422, remote=/192.168.178.22:12686
[OpcUaClientCommunicationManager_0_opc.tcp://192.168.178.22:12686/OPCUA/SampleConsoleServer_8] INFO com.prosysopc.ua.stack.transport.tcp.io.SecureChannelTcp – 1 Closed
[OpcUaClientCommunicationManager_0_opc.tcp://192.168.178.22:12686/OPCUA/SampleConsoleServer_8] INFO com.prosysopc.ua.stack.transport.tcp.io.TcpConnection – /192.168.178.22:12686 Closed
[TcpConnection/Read] INFO com.prosysopc.ua.stack.transport.tcp.io.TcpConnection – /192.168.178.22:12686 Closed (expected)
[OpcUaClientCommunicationManager_0_opc.tcp://192.168.178.22:12686/OPCUA/SampleConsoleServer_8] INFO com.prosysopc.ua.stack.transport.tcp.io.TcpConnection – /192.168.178.22:12686 Connecting
[OpcUaClientCommunicationManager_0_opc.tcp://192.168.178.22:12686/OPCUA/SampleConsoleServer_8] INFO com.prosysopc.ua.stack.transport.tcp.io.TcpConnection – Connected (non-reverse), handshake completed, local=/192.168.178.240:10424, remote=/192.168.178.22:12686
[OpcUaClientCommunicationManager_0_opc.tcp://192.168.178.22:12686/OPCUA/SampleConsoleServer_8] INFO com.prosysopc.ua.client.UaClient – Using OperationLimits [maxMonitoredItemsPerCall=10000, maxNodesPerBrowse=10000, maxNodesPerHistoryReadData=10000, maxNodesPerHistoryReadEvents=10000, maxNodesPerHistoryUpdateData=10000, maxNodesPerHistoryUpdateEvents=10000, maxNodesPerMethodCall=10000, maxNodesPerNodeManagement=10000, maxNodesPerRead=10000, maxNodesPerRegisterNodes=10000, maxNodesPerTranslateBrowsePathsToNodeIds=10000, maxNodesPerWrite=10000]
[OpcUaClientCommunicationManager_0_opc.tcp://192.168.178.22:12686/OPCUA/SampleConsoleServer_8] INFO com.prosysopc.ua.typedictionary.TypeDictionary – TypeDictionary initialized successfully

December 17, 2021
13:37, EET
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 983
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

This is normal, read: https://reference.opcfoundation.org/Core/docs/Part4/5.4.1/

Basically on the first connection we do OpenSecureChannel + GetEndpoints https://reference.opcfoundation.org/Core/docs/Part4/5.4.4/ to obtain the EndpointDescription (the channel is the closed)

Then a second connection is opened with OpenSecureChannel and then CreateSession, ActivateSession etc. follows. The GetEndpoints (the first connection) per spec happens without security thus a second one is needed for the selected security mode as the security mode of the OpenSecureChannel cannot be changed once done.

Theoretically you can skip the first connection if you somehow magically have the EndpointDescription already. It can be set to UaClient.setEndpoint(EndpointDescription endpoint) before calling connect. Though, obtaining that pretty much requires you do do the GetEndpoints; it contents must be exactly as-if you would have received it from the server.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online:
23 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

rocket science: 77

ibrahim: 75

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

fred: 41

Member Stats:

Guest Posters: 0

Members: 682

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1467

Posts: 6259

Newest Members:

DonaldPooma, fidelduke938316, Jan-Pfizer, DavidROunc, fen.pang@woodside.com, aytule, rashadbrownrigg, christi10l, ahamad1, Flores Frederick

Moderators: Jouni Aro: 1009, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 983, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 26, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 321, Lusetti: 0, Ari-Pekka Soikkeli: 5

Administrators: admin: 1