資源簡介
C# OPC UA 客戶端,親測可以使用。這個是西門子的客戶端,對其他也可以使用,對OPC UA 敢興趣的可以參考下。

代碼片段和文件信息
using?System;
using?System.Collections;
using?System.Security.Cryptography.X509Certificates;
using?Opc.Ua;
using?Opc.Ua.Client;
using?Siemens.OpcUA.Helper;
namespace?Siemens.OpcUA
{
????///?
????///?Event?handler?for?the?event?that?the?client?received?a?value?change.
????///?
????public?delegate?void?valueChanged(object?clientHandle?DataValue?value);
????///?
????///?Event?handler?for?the?event?that?the?client?received?a?untrusted?server?certificate.
????///?
????public?delegate?void?certificateValidation(CertificateValidator?validator?CertificateValidationEventArgs?e);
????///?
????///?This?class?encapsulates?a?connection?to?an?OPC?UA?server?and?access?to?particular?Services?of?it.
????///?
????public?class?Server
????{
????????#region?Construction
????????public?Server()
????????{?}
????????#endregion
????????#region?Fields
????????///??
????????///?Keeps?a?session?with?an?UA?server.?
????????///?
????????private?Session?m_Session?=?null;
????????///??
????????///?Interface?which?encapsulates?the?use?of?the?browse?service?of?an?UA?server.?
????????///?
????????private?Browser?m_Browser?=?null;
????????///??
????????///?Keeps?a?hash?table?for?attribute?names.?
????????///?
????????private?Hashtable?m_hashAttributeNames?=?null;
????????#endregion
????????????????
????????#region?Properties
????????///?
????????///?Use?the?certificateValidation?delegate?as?event.
????????///?
????????public?event?certificateValidation?CertificateEvent?=?null;
????????///?
????????///?Provides?the?session?being?established?with?an?OPC?UA?server.
????????///?
????????public?Session?Session
????????{
????????????get?{?return?m_Session;?}
????????}
????????#endregion
?????????????
????????#region?Connect
????????///?Establishes?the?connection?to?an?OPC?UA?server.
????????///?The?Url?of?the?endpoint.
????????///?Result?code.
????????///?Throws?and?forwards?any?exception?with?short?error?description.
????????public?void?Connect(string?Url)
????????{
????????????try
????????????{
????????????????//?Create?the?configuration.?????
????????????????ApplicationConfiguration?configuration?=?Helpers.CreateClientConfiguration();
????????????????//?Create?the?endpoint?description.
????????????????EndpointDescription?endpointDescription?=?Helpers.CreateEndpointDescription(Url);
????????????????//?Create?the?endpoint?configuration?(use?the?application?configuration?to?provide?default?values).
????????????????EndpointConfiguration?endpointConfiguration?=?EndpointConfiguration.Create(configuration);
????????????????//?The?default?timeout?for?a?requests?sent?using?the?channel.
????????????????endpointConfiguration.OperationTimeout?=?300000;
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2010-02-28?23:43??OPC_UA_CODE_v10\
?????目錄???????????0??2010-02-28?23:49??OPC_UA_CODE_v10\bin\
?????文件???????90112??2009-07-03?14:39??OPC_UA_CODE_v10\bin\Opc.Ua.Client.dll
?????文件?????2589184??2009-07-03?14:39??OPC_UA_CODE_v10\bin\Opc.Ua.Core.dll
?????文件???????55296??2010-04-30?11:12??OPC_UA_CODE_v10\bin\Siemens.OpcUA.Client.exe
?????文件???????18944??2010-04-30?11:12??OPC_UA_CODE_v10\bin\Siemens.OpcUA.dll
?????文件???????22528??2010-04-30?11:12??OPC_UA_CODE_v10\bin\Siemens.OpcUA.SimpleClient.exe
?????目錄???????????0??2018-11-01?22:40??OPC_UA_CODE_v10\src\
?????目錄???????????0??2018-11-01?22:32??OPC_UA_CODE_v10\src\.vs\
?????目錄???????????0??2018-11-01?22:32??OPC_UA_CODE_v10\src\.vs\UaClient\
?????目錄???????????0??2018-11-01?22:33??OPC_UA_CODE_v10\src\.vs\UaClient\v15\
?????文件???????72192??2018-11-02?09:46??OPC_UA_CODE_v10\src\.vs\UaClient\v15\.suo
?????目錄???????????0??2018-11-01?22:32??OPC_UA_CODE_v10\src\.vs\UaClient\v15\Server\
?????目錄???????????0??2018-11-01?22:32??OPC_UA_CODE_v10\src\.vs\UaClient\v15\Server\sqlite3\
?????文件???????????0??2018-11-01?22:32??OPC_UA_CODE_v10\src\.vs\UaClient\v15\Server\sqlite3\db.lock
?????文件????????4096??2018-11-01?22:32??OPC_UA_CODE_v10\src\.vs\UaClient\v15\Server\sqlite3\storage.ide
?????文件???????32768??2018-11-02?09:02??OPC_UA_CODE_v10\src\.vs\UaClient\v15\Server\sqlite3\storage.ide-shm
?????文件?????1474992??2018-11-02?09:02??OPC_UA_CODE_v10\src\.vs\UaClient\v15\Server\sqlite3\storage.ide-wal
?????目錄???????????0??2010-02-28?23:46??OPC_UA_CODE_v10\src\bin\
?????文件???????90112??2009-07-03?14:39??OPC_UA_CODE_v10\src\bin\Opc.Ua.Client.dll
?????文件?????2589184??2009-07-03?14:39??OPC_UA_CODE_v10\src\bin\Opc.Ua.Core.dll
?????目錄???????????0??2018-11-01?22:36??OPC_UA_CODE_v10\src\ClientAPI\
?????文件?????????120??2009-08-18?08:48??OPC_UA_CODE_v10\src\ClientAPI\app.config
?????目錄???????????0??2018-11-01?22:32??OPC_UA_CODE_v10\src\ClientAPI\bin\
?????目錄???????????0??2018-11-02?09:02??OPC_UA_CODE_v10\src\ClientAPI\bin\Debug\
?????文件???????90112??2009-07-03?14:39??OPC_UA_CODE_v10\src\ClientAPI\bin\Debug\Opc.Ua.Client.dll
?????文件?????2589184??2009-07-03?14:39??OPC_UA_CODE_v10\src\ClientAPI\bin\Debug\Opc.Ua.Core.dll
?????文件???????19968??2018-11-02?09:02??OPC_UA_CODE_v10\src\ClientAPI\bin\Debug\Siemens.OpcUA.dll
?????文件???????36352??2018-11-02?09:02??OPC_UA_CODE_v10\src\ClientAPI\bin\Debug\Siemens.OpcUA.pdb
?????文件??????446464??2018-08-02?09:05??OPC_UA_CODE_v10\src\ClientAPI\bin\Debug\System.IdentityModel.dll
?????文件??????126976??2018-09-20?09:08??OPC_UA_CODE_v10\src\ClientAPI\bin\Debug\System.IdentityModel.Selectors.dll
............此處省略138個文件信息
評論
共有 條評論