Opc.Ua.Com.ServerFactory.Connect C# (CSharp) Method

Connect() public method

Connects to OPCEnum on the local machine.
public Connect ( ) : void
return void
		public void Connect()
		{
			Connect(null, null);
		}

Same methods

ServerFactory::Connect ( string host, UserIdentity identity ) : void

Usage Example

Exemplo n.º 1
0
        /// <summary>
        /// Updates the list of servers.
        /// </summary>
        private void UpdateServers()
        {
            // populate the list of servers.
            Opc.Ua.Com.ServerFactory factory = new ServerFactory();

            try
            {
                ServersLV.Items.Clear();

                string hostName = HostCB.Text;

                if (HostCB.SelectedIndex != -1)
                {
                    hostName = (string)HostCB.SelectedItem;
                }

                factory.Connect(hostName, null);

                Uri[] serverUrls = factory.GetAvailableServers(Specification.Da20, Specification.Da30);

                for (int ii = 0; ii < serverUrls.Length; ii++)
                {
                    ComServerDescription server = factory.ParseUrl(serverUrls[ii]);

                    ListViewItem item = new ListViewItem(server.ProgId);
                    item.SubItems.Add(server.Description);
                    item.Tag = server;

                    ServersLV.Items.Add(item);
                }

                for (int ii = 0; ii < ServersLV.Columns.Count; ii++)
                {
                    ServersLV.Columns[ii].Width = -2;
                }
            }
            finally
            {
                factory.Disconnect();
            }
        }
All Usage Examples Of Opc.Ua.Com.ServerFactory::Connect