Closed lucviala closed 2 years ago
That's obvious. get_datas() is invoked once on server startup and stored. Each response is populated with a copy of that immutable data.
Thanks @uklotzde to point the lack of my skills on rust development, no offense. :smile:
In reality, I've shown you the least advanced code, but working, to let it as simple as possible, but I already tried to make callback function to be called by call
function and be able to generate response without success.
But as I said, I don't have the skills, and I don't know how to make the response dynamic the right way.
What can I do, implement callback seems to be a good solution, but is it the right way ?
This is not a tokio-modbus issue, but a general programming question.
If I would provide you the correct solution you would probably hit the next road block soon. The solution might also depend on your requirements and goals that I am not aware of.
Yes @uklotzde you've right, I will try to find the solution on my own.
Hi all,
I'm kind of new to rust development, I trying to implement tokio-modbus to get asynchronous tcp server running alongside of random number generator.
And I'm in trouble to get a randomly generated Vec to dispatch through modbus holding registers.
I implemented this kind of code, but response is always the same and never been recomputed:
As you can see the response is always the same and seems the
get_datas
function was executed only once.How can I provide dynamic response to the modbus response ?
Thank you for your help