Skip to content

A pure Python implementation of Ethernet/IP (CIP) raw packets. Includes a Mock PLC Server for testing without hardware.

Notifications You must be signed in to change notification settings

PhilYeh1212/Python-EthernetIP-Raw-Socket-Client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 

Repository files navigation

🏭 Ethernet/IP Raw Packet Debugger & Mock PLC (Python)

Python License Protocol

Master the CIP protocol without expensive hardware. This project demonstrates how to implement the Ethernet/IP (CIP) protocol using pure Python socket and struct libraries. It includes a Mock PLC Server that runs on localhost, allowing you to test the full Forward Open / Forward Close handshake and Implicit Messaging (UDP I/O) without needing a physical Allen-Bradley or Omron PLC.

[Ethernet/IP Debugger Demo]θž’εΉ•ζ“·ε–η•«ι’ 2025-11-18 213948

πŸš€ Features

  • Zero Dependencies: Written in standard Python. No heavy libraries like pycomm3 or cpppo.
  • Full Handshake Implementation:
    • Command 0x65 (Register Session)
    • Command 0x6F (Send RR Data / Forward Open)
    • UDP I/O Data Exchange (Class 1 Implicit Messaging)
  • Mock PLC Included: A server script that simulates a CIP-compliant device, listening on TCP 44818 and UDP 2222.

⚑ Quick Start (How to Run)

Since this simulates a real network connection, you need to run the Server and Client in separate terminals.

Step 1: Start the Mock PLC

Open your first terminal window and run:

python mock_plc_server.py
Output: [Mock PLC] TCP Listening on 44818
Step 2: Start the Client GUI
Open a second terminal window and run:

Bash

python client_gui.py
Step 3: Connect & Test
In the GUI, set Target IP to 127.0.0.1 (Localhost).

Set UDP Port to 2222.

Click β–Ά Start I/O Cycle.

You will see the Hex Dump Logs appearing in both windows, simulating a real-time cyclic data exchange between a Controller (Scanner) and an Adapter.

πŸ“₯ Download Source Code The repository here provides a preview of the architecture.

To get the Complete Source Code (including the GUI implementation, threading logic, and the robust Mock PLC server), you can download the full study kit.

πŸ‘‰ Download the Full Kit on Gumroad ($29):Link

(Includes: client_gui.py, mock_plc_server.py, and a detailed Protocol Guide)

πŸ‘¨β€πŸ’» About the Author Phil Yeh - Senior Automation Engineer

My Gumroad Store (More Engineering Tools)

Keywords: Ethernet/IP, CIP, Industrial Automation, Python, Scada, PLC, Allen-Bradley, Socket Programming, Source Code, Mock Server

About

A pure Python implementation of Ethernet/IP (CIP) raw packets. Includes a Mock PLC Server for testing without hardware.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published