資源簡介
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Text;
using?System.Windows.Forms;
using?RsiOPCAuto;
using?System.Net;
using?System.Collections;
namespace?OPCClient
{
????public?partial?class?FrmRSLinxOPCClient?:?Form
????{
????????public?FrmRSLinxOPCClient()
????????{
????????????InitializeComponent();
????????}
????????#region?私有變量
????????///?
????????///?OPCServer?object
????????///?
????????OPCServer?KepServer;
????????///?
????????///?OPCGroups?object
????????///?
????????OPCGroups?KepGroups;
????????///?
????????///?OPCGroup?object
????????///?
????????OPCGroup?KepGroup;
????????///?
????????///?OPCItems?object
????????///?
????????OPCItems?KepItems;
????????///?
????????///?OPCItem?object
????????///?
????????OPCItem?KepItem;
????????///?
????????///?主機IP
????????///?
????????string?strHostIP?=?““;
????????///?
????????///?主機名稱
????????///?
????????string?strHostName?=?““;
????????///?
????????///?連接狀態
????????///?
????????bool?opc_connected?=?false;
????????///?
????????///?客戶端句柄
????????///?
????????int?itmHandleClient?=?0;
????????///?
????????///?服務端句柄
????????///?
????????int?itmHandleServer?=?0;
????????#endregion
????????#region?方法
????????///?
????????///?枚舉本地OPC服務器
????????///?
????????private?void?GetLocalServer()
????????{
????????????//獲取本地計算機IP計算機名稱
????????????IPHostEntry?IPHost?=?System.Net.Dns.GetHostEntry(Environment.MachineName);
????????????if?(IPHost.AddressList.Length?>?0)
????????????{
????????????????strHostIP?=?IPHost.AddressList[0].ToString();
????????????}
????????????else
????????????{
????????????????return;
????????????}
????????????//通過IP來獲取計算機名稱,可用在局域網內
????????????IPHostEntry?ipHostEntry?=?System.Net.Dns.GetHostEntry(strHostIP);
????????????strHostName?=?ipHostEntry.HostName.ToString();
????????????//獲取本地計算機上的OPCServerName
????????????try
????????????{
????????????????KepServer?=?new?OPCServer();
????????????????object?serverList?=?KepServer.GetOPCServers(strHostName);
????????????????foreach?(string?turn?in?(Array)serverList)
????????????????{
???????????????????//?cmbServerName.Items.Add(turn);
????????????????}
????????????????//cmbServerName.SelectedIndex?=?0;
????????????????//btnConnServer.Enabled?=?true;
????????????}
????????????catch?(Exception?err)
????????????{
????????????????MessageBox.Show(“枚舉本地OPC服務器出錯:“?+?err.Message?“提示信息“?MessageBoxButtons.OK?MessageBoxIcon.Warning);
????????????}
????????}
????????///?
????????///?創建組
????????///?
????????private?bool?CreateGroup()
????????{
????????????try
????????????{
????????????????KepGroups?=?KepServer.OPCGroups;
????????????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????5120??2017-11-07?13:13??OPCClient\.vs\OPCClient\v15\.suo
?????文件????????161??2017-10-10?17:15??OPCClient\app.config
?????文件??????28160??2017-11-07?13:13??OPCClient\bin\Debug\Interop.OPCAutomation.dll
?????文件??????40960??2009-08-29?11:04??OPCClient\bin\Debug\Interop.RsiOPCAuto.dll
?????文件??????20480??2017-11-07?13:16??OPCClient\bin\Debug\OPCClient.exe
?????文件????????161??2017-10-10?17:15??OPCClient\bin\Debug\OPCClient.exe.config
?????文件??????38400??2017-11-07?13:16??OPCClient\bin\Debug\OPCClient.pdb
?????文件??????23168??2017-11-28?14:09??OPCClient\bin\Debug\OPCClient.vshost.exe
?????文件????????161??2017-10-10?17:15??OPCClient\bin\Debug\OPCClient.vshost.exe.config
?????文件????????490??2012-06-06?02:06??OPCClient\bin\Debug\OPCClient.vshost.exe.manifest
?????文件??????24576??2009-08-24?20:55??OPCClient\bin\Debug\OPCConnection.dll
?????文件?????114688??1999-12-16?16:18??OPCClient\bin\Debug\OPCDAAuto.dll
?????文件?????184320??2007-09-18?01:15??OPCClient\bin\Debug\RsiOPCAuto.dll
?????文件??????61287??2009-09-06?11:44??OPCClient\bin\Debug\連接注意.docx
?????文件??????17801??2017-11-07?10:00??OPCClient\FrmRSLinxOPCClient.cs
?????文件??????18121??2017-08-24?15:25??OPCClient\FrmRSLinxOPCClient.Designer.cs
?????文件???????6014??2017-08-24?15:25??OPCClient\FrmRSLinxOPCClient.resx
?????文件????????180??2009-09-06?15:56??OPCClient\obj\Debug\ChangeDbl
?????文件?????????42??2017-11-07?10:02??OPCClient\obj\Debug\CoreCompileInputs.cache
?????文件???????1453??2017-11-16?09:11??OPCClient\obj\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件???????6970??2017-11-07?10:04??OPCClient\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件??????28160??2017-11-07?13:13??OPCClient\obj\Debug\Interop.OPCAutomation.dll
?????文件??????40960??2009-08-29?11:04??OPCClient\obj\Debug\Interop.RsiOPCAuto.dll
?????文件???????2038??2017-11-28?14:09??OPCClient\obj\Debug\OPCClient.csproj.FileListAbsolute.txt
?????文件????????917??2017-11-07?13:16??OPCClient\obj\Debug\OPCClient.csproj.GenerateResource.Cache
?????文件????????771??2017-11-07?13:13??OPCClient\obj\Debug\OPCClient.csproj.ResolveComReference.cache
?????文件??????10352??2017-11-07?13:16??OPCClient\obj\Debug\OPCClient.csprojResolveAssemblyReference.cache
?????文件??????20480??2017-11-07?13:16??OPCClient\obj\Debug\OPCClient.exe
?????文件????????180??2009-09-06?15:59??OPCClient\obj\Debug\OPCClient.FrmDataCollecter.resources
?????文件????????180??2017-11-07?13:16??OPCClient\obj\Debug\OPCClient.FrmRSLinxOPCClient.resources
............此處省略33個文件信息
評論
共有 條評論