Opc.Ua.Client.Session.Open C# (CSharp) Method

Open() public method

Establishes a session with the server.
public Open ( string sessionName, IUserIdentity identity ) : void
sessionName string The name to assign to the session.
identity IUserIdentity The user identity.
return void
        public void Open(
            string        sessionName,
            IUserIdentity identity)
        {
            Open(sessionName, 0, identity, null);
        }

Same methods

Session::Open ( string sessionName, uint sessionTimeout, IUserIdentity identity, IList preferredLocales ) : void
Session::Open ( string sessionName, uint sessionTimeout, IUserIdentity identity, IList preferredLocales, bool checkDomain ) : void

Usage Example

Example #1
0
        /// <summary>
        /// Creates a new session.
        /// </summary>
        private Session CreateSession()
        {
            try
            {
                Cursor = Cursors.WaitCursor;

                ServiceMessageContext messageContext = m_configuration.CreateMessageContext();
                BindingFactory bindingFactory = BindingFactory.Create(m_configuration, messageContext);

                ConfiguredEndpoint endpoint = this.EndpointsCTRL.SelectedEndpoint;
                
                endpoint.UpdateFromServer(bindingFactory);
                                
                // Initialize the channel which will be created with the server.
                ITransportChannel channel = SessionChannel.Create(
                    m_configuration,
                    endpoint.Description,
                    endpoint.Configuration,
                    m_configuration.SecurityConfiguration.ApplicationCertificate.Find(true),
                    messageContext);

                // Wrap the channel with the session object.
                Session session = new Session(channel, m_configuration, endpoint, null);

                // Create the session. This actually connects to the server.
                session.Open(Guid.NewGuid().ToString(), null);

                return session;
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }
All Usage Examples Of Opc.Ua.Client.Session::Open