.NET 8 OPC DA client library - Seamlessly connect to local/remote OPC servers, read real-time process data, and subscribe to data changes with simple, modern C# API
- User Guide - Complete guide for using SimpleOpcCom
- Quick Start - Get started in 5 minutes
- Examples - Code examples and usage patterns
- Troubleshooting - Solutions to common issues
- Developer Guide - Architecture and implementation details
- API Reference - Complete API documentation
- Impersonation Guide - Windows impersonation for remote connections
- OPC DA Fundamentals - What is OPC DA?
- COM/DCOM Explained - Understanding the underlying technology
- Security Best Practices - Production deployment security
# Clone the repository
git clone https://github.com/yourusername/SimpleOpcCom.git
# Build the library
cd SimpleOpcCom
dotnet build SimpleOpcCom.slnusing SimpleOpcCom;
// Create client
using var client = new OpcDaClient();
// Connect to OPC server
var options = new OpcConnectionOptions("localhost", "Matrikon.OPC.Simulation.1");
client.Connect(options);
// Read data
var value = client.Read("Random.Int4");
Console.WriteLine($"Value: {value.Value}, Quality: {value.QualityString}");
// Subscribe to real-time changes
var key = client.Subscribe(
new[] { "Random.Int4", "Random.Real8" },
values => {
foreach (var v in values)
Console.WriteLine($"{v.ItemName} = {v.Value} [{v.QualityString}]");
},
updateRate: 1000 // Update every 1 second
);
// Disconnect (automatic with 'using')See Quick Start Guide for detailed 5-minute tutorial.
- ✅ Local and remote connections - Connect to OPC servers on any machine
- ✅ Windows impersonation - Use different credentials for remote servers
- ✅ Automatic DCOM configuration - Seamless remote communication
- ✅ Connection state monitoring - Know when connected/disconnected
- ✅ Synchronous reading - On-demand data retrieval with immediate results
- ✅ Asynchronous reading - Non-blocking async/await operations
- ✅ Batch reading - Read multiple items efficiently in one call
- ✅ Real-time subscriptions - Get callbacks when data changes
- ✅ Quality checking - Built-in validation of data reliability
- ✅ Server discovery - Automatically find OPC servers on network
- ✅ Address space browsing - Navigate hierarchical tag structure
- ✅ Item descriptions - Retrieve user-friendly tag names
- ✅ Thread-safe operations - Safe for concurrent access
- ✅ Proper COM cleanup - No memory leaks
- ✅ Dynamic cloaking - Advanced security for remote connections
- ✅ Comprehensive error handling - Detailed error messages and translations
SimpleOpcCom is a modern, robust .NET library for communicating with OPC DA (Data Access) servers. It provides:
- Simple API - Easy-to-use interface for OPC DA operations
- Multi-targeting - Supports .NET 6.0, 7.0, and 8.0
- Thread-safe - Safe for concurrent operations
- Proper Resource Management - Automatic COM cleanup with IDisposable pattern
- Production-Ready - Comprehensive error handling and logging support
Core Library:
SimpleOpcCom/- Main class library (.NET 6.0/7.0/8.0)OpcDaClient- Main client classOpcConnectionOptions- Connection configurationOpcItemValue- Data modelOpcException- Custom exception handling
Example Applications:
Examples/OpcDaClient-BasicUsage/- Console application demonstrating basic usageExamples/OpcDaClient-Impersonation/- Windows impersonation exampleExamples/OpcDaService/- Production-ready Windows Service
GUI Application:
SimpleOpcCom.WpfClient/- Professional WPF desktop application- Server discovery and browsing
- Real-time data monitoring with visual indicators
- Profile management with save/load
- Subscription management
- Operating System: Windows 7/8/10/11, Server 2012 or later
- .NET Runtime: .NET 6.0, 7.0, or 8.0 Runtime
- Platform: x86 (32-bit) - Required for OPC DA COM compatibility
- .NET SDK: .NET 8.0 SDK or later
- IDE: Visual Studio 2022 or Visual Studio Code
- OPC Server: Any OPC DA 2.0/3.0 compatible server for testing
- TCP port 135 (DCOM endpoint mapper)
- TCP ports 49152-65535 (dynamic RPC ports)
- Proper DCOM permissions configured
using SimpleOpcCom;
// Connect to remote OPC server with different credentials
var options = new OpcConnectionOptions("192.168.1.100", "Matrikon.OPC.Simulation.1")
{
UseImpersonation = true,
ImpersonationUsername = "opcuser",
ImpersonationPassword = "password",
ImpersonationDomain = "192.168.1.100" // Server hostname for local account
};
using var client = new OpcDaClient();
client.Connect(options);
// All operations now use impersonated credentials
var values = client.Read(new[] { "Random.Int4", "Random.Real8" });
foreach (var value in values)
{
Console.WriteLine($"{value.ItemName} = {value.Value} [{value.QualityString}]");
}See Impersonation Guide for complete documentation.
Documentation/
├── User-Guide/ # User-facing documentation
│ ├── USER-GUIDE.md # Complete user guide
│ ├── QUICK-START.md # 5-minute tutorial
│ ├── EXAMPLES.md # Code examples
│ ├── WINDOWS-SERVICE-GUIDE.md # Windows Service deployment
│ └── WPF-CLIENT-GUIDE.md # WPF GUI application guide
│
├── Developer-Guide/ # Developer documentation
│ ├── DEVELOPER-GUIDE.md # Complete developer guide
│ ├── API-REFERENCE.md # API documentation
│ └── IMPERSONATION-GUIDE.md # Windows impersonation deep-dive
│
├── Theory-and-Concepts/ # Educational content
│ ├── OPC-DA-FUNDAMENTALS.md # OPC DA concepts
│ ├── COM-DCOM-EXPLAINED.md # COM/DCOM technology
│ ├── SECURITY-BEST-PRACTICES.md # Security guidance
│ └── NETWORK-CONFIGURATION.md # Network setup
│
└── Troubleshooting/ # Problem-solving guides
├── TROUBLESHOOTING-GUIDE.md # Complete troubleshooting
├── SUBSCRIPTION-TROUBLESHOOTING.md # Subscription-specific issues
├── CONNECTION-ISSUES.md # Connection problems
└── DCOM-CONFIGURATION.md # DCOM setup guide
Browse Complete Documentation →
"Class not registered" error? → Ensure your application targets x86 platform (not AnyCPU or x64). Most OPC DA servers are 32-bit.
Remote connection fails? → Check DCOM permissions and firewall configuration. See DCOM Configuration Guide.
Subscriptions not receiving updates? → Ensure subscribed items have changing values (OPC DA subscriptions are change-driven). See Subscription Troubleshooting.
Complete Troubleshooting Guide →
- Matrikon OPC Explorer - Free OPC testing and browsing tool
- Matrikon OPC Simulation Server - Free OPC server for development/testing
- OPC Foundation - Official OPC standards organization
- OPC DA Specification - Technical specification
- Microsoft DCOM Documentation - DCOM configuration reference
v1.0.0 (2025-11-04)
- Initial release
- Core OpcDaClient library with full OPC DA support
- Windows impersonation for remote connections
- Real-time subscription functionality
- Example console applications
- Production-ready Windows Service
- Professional WPF GUI client
- Comprehensive documentation
We welcome contributions! Please see the Contributing Guide for details on:
- Code standards and conventions
- Development workflow
- Testing requirements
- Pull request process
[Add license information here]
- Documentation: See Documentation/ folder
- Issues: Report bugs or request features via GitHub Issues
- Questions: Check Troubleshooting Guide first
Built with ❤️ for industrial automation
Last Updated: 2025-11-14 | Version: 1.0.0