xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 7.91KB
    文件類型: .zip
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2024-04-29
  • 語(yǔ)言: C#
  • 標(biāo)簽: Server??PLC??連接??代碼??

資源簡(jiǎn)介

【實(shí)例簡(jiǎn)介】該實(shí)例介紹一個(gè)簡(jiǎn)單的通過(guò)kepserver通過(guò)OPC 連接PLC的代碼

【文件目錄】

KepServer-OPC-connect-to-PLC-master

├── C# Code
├── OPC_PLC_Code1.cs
└── OPC_PLC_Code2.cs

0 directories, 3 files


資源截圖

代碼片段和文件信息

///摘要
///程式使用C#.NET?2005?編寫
///引用類庫(kù)OPCDAAuto.dll
///OPCServer采用KEPWare
///在windows?xp?sp2、sp3、windows?2003上測(cè)試通過(guò)
///完成于:2008年12月31日
///測(cè)試于:2009年01月05日
///
///作者:瀟灑草
///Email:zhkai868@163.com
///QQ:44649029
///?
///如分發(fā),請(qǐng)保留此摘要。
///鄙視那些拿代碼當(dāng)寶貝的人,鄙視那些你不拿源碼換就不稀罕你的人,鄙視那些自私的人。
///別人看到你的代碼,你能死啊?對(duì)你有多大威脅?。繌?qiáng)烈鄙視~~~
///如果你是這樣的人,趕緊關(guān)了。。偶不歡迎。。
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Text;
using?System.Windows.Forms;
using?System.Net;
using?System.Collections;
using?OPCAutomation;
namespace?OPC測(cè)試通過(guò)
{
????public?partial?class?MainFrom?:?Form
????{
????????public?MainFrom()
????????{
????????????InitializeComponent();
????????}
????????#region?私有變量
????????///?
????????///?OPCServer?object
????????///?

????????OPCServer?KepServer;
????????///?
????????///?OPCGroups?object
????????///?

????????OPCGroups?KepGroups;
????????///?
????????///?OPCGroup?object
????????///?

????????OPCGroup?KepGroup;
????????///?
????????///?OPCItems?object
????????///?

????????OPCItems?KepItems;
????????///?
????????///?OPCItem?object
????????///?

????????OPCItem?KepItem;
????????///?
????????///?主機(jī)IP
????????///?

????????string?strHostIP?=?““;
????????///?
????????///?主機(jī)名稱
????????///?

????????string?strHostName?=?““;
????????///?
????????///?連接狀態(tài)
????????///?

????????bool?opc_connected?=?false;
????????///?
????????///?客戶端句柄
????????///?

????????int?itmHandleClient?=?0;
????????///?
????????///?服務(wù)端句柄
????????///?

????????int?itmHandleServer?=?0;
????????#endregion
????????#region?方法
????????///?
????????///?枚舉本地OPC服務(wù)器
????????///?

????????private?void?GetLocalServer()
????????{
????????????//獲取本地計(jì)算機(jī)IP計(jì)算機(jī)名稱
????????????IPHostEntry?IPHost?=?Dns.Resolve(Environment.MachineName);
????????????if?(IPHost.AddressList.Length?>?0)
????????????{
????????????????strHostIP?=?IPHost.AddressList[0].ToString();
????????????}
????????????else
????????????{
????????????????return;
????????????}
????????????//通過(guò)IP來(lái)獲取計(jì)算機(jī)名稱,可用在局域網(wǎng)內(nèi)
????????????IPHostEntry?ipHostEntry?=?Dns.GetHostByAddress(strHostIP);
????????????strHostName=ipHostEntry.HostName.ToString();
????????????//獲取本地計(jì)算機(jī)上的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服務(wù)器出錯(cuò):“+err.Message“提示信息“MessageBoxButtons.OKMessageBoxIcon.Warning);
????????????}
????????}
????????///?

????????///?創(chuàng)建組
?????

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-12-08?03:47??KepServer-OPC-connect-to-PLC-master\
?????文件?????????154??2017-12-08?03:47??KepServer-OPC-connect-to-PLC-master\C#?Code
?????文件???????12880??2017-12-08?03:47??KepServer-OPC-connect-to-PLC-master\OPC_PLC_Code1.cs
?????文件???????15035??2017-12-08?03:47??KepServer-OPC-connect-to-PLC-master\OPC_PLC_Code2.cs

評(píng)論

共有 條評(píng)論

相關(guān)資源