Skip to content

How to run server with callback and asnyc #2444

Answered by ilkka-ollakka
utack asked this question in Help
Discussion options

You must be logged in to vote

You could get forward with following changes:

  • Instead of ModbusSequentialDataBlock use ModbusBaseSlaveContext as base-class of your own implementation
  • reimplement async_getValues and async_setValues as you have done (check that you have defined them async, I assume it is typo in your example not to be there)
  • create your class as slave-object directly instead of passing it to ModbusSlaveContext, so something like context = ModbusServerContext(slaves=CallbackDataBlock()) in your example-code

I assume you can already connect to server via serial connection and all that is working as expected?

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@janiversen
Comment options

Comment options

You must be logged in to vote
1 reply
@janiversen
Comment options

Answer selected by janiversen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants