Skip to content

Drop C++ standard to C++17 and add multicast T2O support#125

Open
chace219 wants to merge 5 commits into
nimbuscontrols:masterfrom
chace219:feature/cxx17-uclibc-rockchip
Open

Drop C++ standard to C++17 and add multicast T2O support#125
chace219 wants to merge 5 commits into
nimbuscontrols:masterfrom
chace219:feature/cxx17-uclibc-rockchip

Conversation

@chace219

@chace219 chace219 commented Jul 1, 2026

Copy link
Copy Markdown

This pull request adds support for receiving I/O data over multicast UDP in addition to unicast, making the library compatible with EtherNet/IP devices that use multicast for T2O (Target-to-Originator) connections. The changes include detection of multicast addresses, correct socket binding and group joining, handler refactoring, and documentation updates. The C++ standard is also downgraded from C++20 to C++17 for compatibility with the Luckfox/RV1106 SDK toolchain.

Multicast I/O support:

  • Added detection of multicast addresses and logic to join multicast groups for T2O (Target-to-Originator) I/O data, including new methods findOrCreateMulticastSocket, attachIoReceiveHandler, and the use of joinMulticastGroup in ConnectionManager.cpp and UDPBoundSocket. This allows the library to receive multicast I/O packets as required by some EtherNet/IP devices. [1] [2] [3] [4] [5]

  • Refactored socket receive handler logic to improve clarity and robustness, including checks for malformed packets and clearer separation of handler attachment.

Platform and portability improvements:

  • Added platform-specific includes for socket headers to support both UNIX-like systems and Windows, improving cross-platform compatibility. [1] [2]

Build and documentation updates:

  • Downgraded the required C++ standard from C++20 to C++17 in CMakeLists.txt and updated the README.md to reflect this, ensuring compatibility with GCC 8.3 and the Luckfox/RV1106 SDK. [1] [2]

chace219 and others added 5 commits June 16, 2026 15:43
Upstream sets CMAKE_CXX_STANDARD 20, which the SDK cross toolchain
(arm-rockchip830-linux-uclibcgnueabihf-g++ 8.3.0) cannot compile. The
codebase uses no C++20-only features, so dropping to C++17 is a clean
change. A bare set() in CMakeLists also overrides -DCMAKE_CXX_STANDARD
from the buildroot package, so the source must carry the standard.

Cross-compiled clean (lib + all examples incl. implicit_messaging) for
ARM with GCC 8.3.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
EIPScanner previously only set up a unicast T2O receive socket
(findOrCreateSocket bound to host:2222), ignoring T2O_SOCKADDR_INFO. So
adapters that produce inputs to a multicast group were never received and
the scanner fell back to / required point-to-point.

This adds multicast T2O receive:
  - UDPBoundSocket::joinMulticastGroup() — IP_ADD_MEMBERSHIP on the bound
    socket; IP_DROP_MEMBERSHIP in the destructor.
  - ConnectionManager parses T2O_SOCKADDR_INFO from the Forward_Open
    response; if the advertised T2O address is multicast (224/4) it
    creates a group-joined receive socket, else unicast (unchanged).
  - Shared receive handler (attachIoReceiveHandler) demuxes by T2O
    connection id for both unicast and multicast sockets.

Selectable per connection by the originator requesting MULTICAST vs P2P
t2o network connection params. Cross-compiles C++17/GCC 8.3 for ARM.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Binding the multicast receive socket to INADDR_ANY:2222 alongside the
unicast receive socket on the same port made unicast-vs-multicast
delivery ambiguous in mixed deployments. Add a bindToGroup option to
UDPBoundSocket and bind the multicast socket to the group address so it
only receives that group's datagrams; unicast still binds INADDR_ANY.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@JohannesKauffmann

Copy link
Copy Markdown
Collaborator

Hi, nowadays I am far from the maintainer, but I did take a quick look at your first commit. Unfortunately MSVC doesn't support designated initializers before C++20:

[21/90] Building CXX object src\CMakeFiles\EIPScanner.dir\sockets\BaseSocket.cpp.obj
FAILED: src/CMakeFiles/EIPScanner.dir/sockets/BaseSocket.cpp.obj
C:\PROGRA~1\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1441~1.341\bin\Hostx64\x86\cl.exe  /nologo /TP -DEIPScanner_EXPORTS -DNOMINMAX -D_WIN32_WINNT=0x0600 -IC:\eipscanner\src /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MDd /Zi /Ob0 /Od /RTC1   -std:c++17 /showIncludes /Fosrc\CMakeFiles\EIPScanner.dir\sockets\BaseSocket.cpp.obj /Fdsrc\CMakeFiles\EIPScanner.dir\ /FS -c C:\eipscanner\src\sockets\BaseSocket.cpp
C:\eipscanner\src\sockets\BaseSocket.cpp(101): error C7555: use of designated initializers requires at least '/std:c++20'
ninja: build stopped: subcommand failed.

which is why it was bumped to C++20 in the first place: 7df05f1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants