测试代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OPCAutomation;
using System.Net;
using System.Runtime.CompilerServices;
using System.Threading;
namespace OPCtest
{
class Program
{
static void Main(string[] args)
{
OPCServer opcServer;
OPCGroup opcGroup;
OPCGroups opcGroups;
OPCItems opcItems;
OPCBrowser opcBrowser;
List<String> HostNameList = new List<string>();
Thread thread = new Thread(() =>
{
IPHostEntry iPHostEntry = Dns.GetHostEntry(Environment.MachineName);
foreach (var item in iPHostEntry.AddressList)
{
string str = Dns.GetHostEntry(item.ToString()).HostName;
if (!HostNameList.Contains(str))
{
HostNameList.Add(