Replies: 2 comments 3 replies
-
You need to use ModbusAsyncTcpServer instead and build your own logic around it. You are effectively creating 2 async loops (2 asyncio.run) so they cannot see each other. |
Beta Was this translation helpful? Give feedback.
-
Let me try to analyze your program, to show why we cannot provide examples You use Thread so your program is clearly a sync. program. You call startAsyncModbusServer instead of the sync. variant so it's fair to assume you need a part of your program to be async. You then start a second loop with asyncio.run to call serverAsyncStop instead of using the sync version. Either you have a very advanced program (2 asyncio loop, is something you do not see every day. Anyhow I hope my explanation shows you why we cannot provide examples for such advanced usage, and to be honest for advanced usage it is a lot to use the ModbusAsyncServer directly. |
Beta Was this translation helpful? Give feedback.
-
Hi there,
I know a similiar question was asked here before and answered but the answer won't work for me at all. I have a thread class which starts an asynchronous modbus server before run. Within a loop this class gets data which is populated to the modbus server. Until this point everything works fine. At some time the thread is canceled but I didÄnt find any way to stop the modbus server as well. Here is a slimmed down example:
Hope anybody can help me out here. Thx in advance Steven
Beta Was this translation helpful? Give feedback.
All reactions