# atMb 0.6 — threaded communication and client statistics This update moves TCP/RTU transaction progress and TCP server I/O into one shared C worker thread. The worker also handles connection recovery between PLC scans. The IEC task still selects/submits the next client request and exchanges slave memory. One C worker serves the fixed pools; it is not a separate thread per device. Start with [upgrade/build instructions](docs/BUILD-AND-USAGE.md), then read the [user guide](docs/USER-GUIDE.md) and [API reference](docs/API-REFERENCE.md). ## Required upgrade Rebuild the C component as **0.4.0.0**, import `library/atMb-Threaded.export` into a fresh CODESYS library project and embed the new `.so` for the device target. The external function signature is unchanged, but new commands are required. The new IEC wrapper checks capability version and rejects an older component. This package contains updated source/export, not an IDE-compiled updated `.library` or rebuilt ARM binaries. The previous files are retained under `backup/` only. ## Changes - Worker defaults: 1 ms sleep, normal OS scheduling, 2 s per-context scan watchdog. - Optional `atMb.Worker` FB sets CPU affinity, sleep interval and watchdog. - Completion and read data stay latched until acknowledged; failed writes are not replayed by the worker. IEC cyclic retries remain configurable via write holds. - Server dirty tracking preserves remote writes until the PLC pulls them. - Public diagnostics now use `out_errorCode` and `out_lastErrorCode`. - `client.stats` aggregates every registered request's counters and timings. - Both TCP and RTU clients show `OK:/Er:` like requests. - Accurate worker transaction durations; timeout counts classify actual timeouts. ## Files - `component-source/`: protocol implementation, worker, component frame and tests. - `ExtensionSDK/`: required SDK headers/macros/build support. - `library/atMb-Threaded.export`: importable IEC source; no old embedded binary. - `library/atMb-Threaded-Review.st`: readable export source. - `docs/`: usage, ABI/worker notes, migration, validation and reference. - `backup/`: original library/export/binaries for rollback, not the new release. Host tests run with `make -C component-source test`. Physical PLC/RTU testing and CODESYS IDE compilation remain required. Online-change qualification is future work; use a full download for this structural update. Git changes are not committed/pushed.