Multiple Server #1789
-
Is there any example to start multiple tcp server and stop the server one by one for pymodbus 3.5.2? I used multiple threads to start tcp server with different port, and call serverstop() to close the server, but it only closed the last active one, but others cannot be stop. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Using multiple threads is asking for trouble, mixing threads and asyncio normally causes problem. Use the async classes (start/stop methods) they can run multiple servers out of the box. There are no specific example, but any server started with StartAsync can run in parallel automatically. |
Beta Was this translation helpful? Give feedback.
It only blocks the thread if you do await, but look in the code then you can see how we do it.