This function executes cyclic at an endless loop:
1: Wait passive for client connection (with socket call accept())
2: Receive incoming Modbus requests and
3: calls the corresponding user-specific callback function (see mbtcp_srv_init()) and
4: sends the result (returned by the callback function) as a Mobus reply back to the master.
This function can be called as a Modbus TCP server at a separate task.
Calling mbtcp_srv_loop_stop() from outside of this task loop, will force an exit of the loop.
|[in] ||handle,: ||Handle returned by mbtcp_srv_init() |
|[in] ||delayMs,: ||If delayMs!=0 this function sleeps delayMs milliseconds after each loop cycle.|
- -2: Error: Invalid handle parameter
else 0 (when stopped by mbtcp_srv_loop_stop())