# Giselle.Net.EtherNetIP **Repository Path**: ouriping/Giselle.Net.EtherNetIP ## Basic Information - **Project Name**: Giselle.Net.EtherNetIP - **Description**: No description available - **Primary Language**: C# - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-11-24 - **Last Updated**: 2026-11-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Giselle.Net.EtherNetIP A C# library for implementing EtherNet/IP (CIP) protocol communication. This library provides support for CIP EtherNet/IP messaging, including getting/setting assembly data and implicit messaging. ## Features - **CIP EtherNet/IP Protocol**: Full implementation of the Common Industrial Protocol over EtherNet/IP - **Assembly Object Support**: Get and set assembly instance data - **Explicit Messaging**: Support for connected and unconnected messaging via Forward Open/Close - **Implicit Messaging**: Real-time I/O communication with configurable real-time formats - **Attribute Operations**: Read and write device attributes - **Session Management**: TCP session registration and management ## Installation This is a .NET library. Add the project reference or build the solution: ```bash # Clone the repository git clone https://gitee.com/ouriping/Giselle.Net.EtherNetIP.git # Build the solution dotnet build Giselle.Net.EtherNetIP.sln ``` ## Project Structure - **Giselle.Net.EtherNetIP** - Core library - `CIP/` - Common Industrial Protocol implementation - `ENIP/` - EtherNet/IP encapsulation and client - **Giselle.Net.EtherNetIP.Test** - Test project with examples ## Quick Start ### Basic Connection and Identification ```csharp using Giselle.Net.EtherNetIP; using Giselle.Net.EtherNetIP.ENIP; using Giselle.Net.EtherNetIP.CIP; var client = new ENIPSimpleClient(); client.Connect(IPAddress.Parse("192.168.1.100")); // Get device identification var identify = client.GetIdentifyAttributes(); Console.WriteLine($"Vendor ID: {identify.VenderId}"); Console.WriteLine($"Device Type: {identify.DeviceType}"); Console.WriteLine($"Product Name: {identify.ProductName}"); Console.WriteLine($"Serial Number: {identify.SerialNumber}"); ``` ### Get/Set Assembly Data ```csharp // Read assembly data var data = client.GetAssemblyData(instanceId: 100); byte[] bytes = data.ReadBytes(data.Remain); // Write assembly data client.SetAssemblyData(instanceId: 100, bytes => { bytes.WriteInt(12345); bytes.WriteFloat(3.14f); }); ``` ### Implicit Messaging (Real-Time I/O) ```csharp var options = new ForwardOpenOptions { O_T_Assembly = new AssemblyObject { InstanceId = 100, ConnectionType = ConnectionType.PointToPoint }, T_O_Assembly = new AssemblyObject { InstanceId = 150, ConnectionType = ConnectionType.PointToPoint }, ConnectionSerialNumber = 1, OriginatorVenderId = 1, OriginatorSerialNumber = 123456 }; var result = client.ForwardOpen(options); // Handle received messages client.ImplicitMessageReceived += (sender, data) => { Console.WriteLine($"Received: {BitConverter.ToString(data)}"); }; ``` ## Key Classes | Class | Description | |-------|-------------| | `ENIPSimpleClient` | Main client for EtherNet/IP TCP communication | | `CIPCodec` | CIP protocol encoder/decoder | | `ENIPCodec` | EtherNet/IP encapsulation codec | | `ForwardOpenOptions` | Options for establishing a connection | | `ForwardOpenResult` | Result of Forward Open request | | `AssemblyObject` | Assembly object configuration | | `EPath` | CIP Electronic Path representation | | `DataProcessor` | Binary data read/write utility | ## References - [Wireshark EtherNet/IP Dissector](https://github.com/boundary/wireshark/blob/master/epan/dissectors/packet-enip.c) - [Rockwell Automation CIP Reference](https://literature.rockwellautomation.com/idc/groups/literature/documents/pm/1756-pm020_-en-p.pdf) - [Hilscher EtherNet/IP Adapter Protocol API](https://www.hilscher.com/fileadmin/cms_upload/ja/Resources/pdf/EtherNetIP_Adapter_V3_Protocol_API_04_EN.pdf) ## License MIT License Copyright (c) 2022 gisellevonbingen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.