Hello - in a C++ SDK Client, it is possible to set connection information using the SessionConnectInfo class. In the server end, how can we read the information that the client provides?
Thank you
SessionConnectInfo information in a UA Server
Moderator: uasdkcpp
-
- Sr. Member
- Posts: 10
- Joined: 09 May 2017, 10:44
- Support Team
- Hero Member
- Posts: 3072
- Joined: 18 Mar 2011, 15:09
Re: SessionConnectInfo information in a UA Server
Hello Chris,
can you please let me know what kind of information you want to set? In the SessionConnectInfo you can for example set the SessionName.
can you please let me know what kind of information you want to set? In the SessionConnectInfo you can for example set the SessionName.
Best regards
Unified Automation Support Team
Unified Automation Support Team
-
- Sr. Member
- Posts: 10
- Joined: 09 May 2017, 10:44
Re: SessionConnectInfo information in a UA Server
Good Morning Support and thank you for your reply.
Our UA Client already sets information in SessionConnectInfo :
auto cert = UaPkiCertificate::fromDER(sessionSecurityInfo.clientCertificate);
UaPkiCertificateInfo info = cert.info();
// Fill session connect info with data from configuration
sessionConnectInfo.sApplicationName = cert.commonName();
// Use the host name to generate a unique application URI
sessionConnectInfo.sApplicationUri = info.URI;
sessionConnectInfo.sProductUri = UaString("urn:%1:%2").arg(COMPANY_NAME).arg(PRODUCT_NAME);
sessionConnectInfo.sSessionName = sessionConnectInfo.sApplicationUri;
sessionConnectInfo.bAutomaticReconnect = true;
sessionConnectInfo.bRetryInitialConnect = false;
sessionConnectInfo.nConnectTimeout = m_lTimeout;
sessionConnectInfo.nSessionTimeout = m_lTimeout;
sessionConnectInfo.nMaxOperationsPerServiceCall = m_maxOperationsPerServiceCall;
What we would like to do is to related to our UA Server. We would like to know which UA Client Application is connecting to the UA Server.
How can this information be read in the UA Server; for example can the UA Server read the ProductUri as set in sessionConnectInfo?
Thanks
Our UA Client already sets information in SessionConnectInfo :
auto cert = UaPkiCertificate::fromDER(sessionSecurityInfo.clientCertificate);
UaPkiCertificateInfo info = cert.info();
// Fill session connect info with data from configuration
sessionConnectInfo.sApplicationName = cert.commonName();
// Use the host name to generate a unique application URI
sessionConnectInfo.sApplicationUri = info.URI;
sessionConnectInfo.sProductUri = UaString("urn:%1:%2").arg(COMPANY_NAME).arg(PRODUCT_NAME);
sessionConnectInfo.sSessionName = sessionConnectInfo.sApplicationUri;
sessionConnectInfo.bAutomaticReconnect = true;
sessionConnectInfo.bRetryInitialConnect = false;
sessionConnectInfo.nConnectTimeout = m_lTimeout;
sessionConnectInfo.nSessionTimeout = m_lTimeout;
sessionConnectInfo.nMaxOperationsPerServiceCall = m_maxOperationsPerServiceCall;
What we would like to do is to related to our UA Server. We would like to know which UA Client Application is connecting to the UA Server.
How can this information be read in the UA Server; for example can the UA Server read the ProductUri as set in sessionConnectInfo?
Thanks
- Support Team
- Hero Member
- Posts: 3072
- Joined: 18 Mar 2011, 15:09
Re: SessionConnectInfo information in a UA Server
Hello Chris,
yes - in the server in any place where you have access to the client session (e.g. logonSessionUser or any of the NodeManager and/or IOManager interfaces) you can access the client application description.
see also:
https://documentation.unified-automation.com/uasdkcpp/1.8.1/html/classSession.html#ad5c3fb12fabbe816f0e4a59cb9fdbcf3
and
https://documentation.unified-automation.com/uasdkcpp/1.8.1/html/classUaApplicationDescription.html
yes - in the server in any place where you have access to the client session (e.g. logonSessionUser or any of the NodeManager and/or IOManager interfaces) you can access the client application description.
Code: Select all
UaApplicationDescription clientApplicationDescription = pSession->getClientApplicationDescription();
https://documentation.unified-automation.com/uasdkcpp/1.8.1/html/classSession.html#ad5c3fb12fabbe816f0e4a59cb9fdbcf3
and
https://documentation.unified-automation.com/uasdkcpp/1.8.1/html/classUaApplicationDescription.html
Best regards
Unified Automation Support Team
Unified Automation Support Team
-
- Sr. Member
- Posts: 10
- Joined: 09 May 2017, 10:44
Re: SessionConnectInfo information in a UA Server
Thank you Support
-
- Sr. Member
- Posts: 10
- Joined: 09 May 2017, 10:44
Re: SessionConnectInfo information in a UA Server
Hello again Support,
we have tried accessing the client session from the following 3 methods:
sessionOpened
logonSessionUser, and
sessionClosed.
For the latter 2 methods, we can see the application information.
For the first method, there is no application information.
Is this to be expected, and if so, could you explain why?
Thank you
we have tried accessing the client session from the following 3 methods:
sessionOpened
logonSessionUser, and
sessionClosed.
For the latter 2 methods, we can see the application information.
For the first method, there is no application information.
Is this to be expected, and if so, could you explain why?
Thank you
- Support Team
- Hero Member
- Posts: 3072
- Joined: 18 Mar 2011, 15:09
Re: SessionConnectInfo information in a UA Server
Hello Chris,
the Session is not completely configured at the point of time when sessionOpened is called. Use sessionActivated instead to hook in.
That makes sense also if you want to access the UserToken assigned to the session since that does not happens in the CreateSession service but in the service ActivateSession.
the Session is not completely configured at the point of time when sessionOpened is called. Use sessionActivated instead to hook in.
That makes sense also if you want to access the UserToken assigned to the session since that does not happens in the CreateSession service but in the service ActivateSession.
Best regards
Unified Automation Support Team
Unified Automation Support Team
-
- Sr. Member
- Posts: 10
- Joined: 09 May 2017, 10:44
Re: SessionConnectInfo information in a UA Server
Good Morning Support - yes activateSession works.
Many thanks
Chris
Many thanks
Chris