0

I am a newbie in python. Sorry if the question may sound silly.

I'm using pyModbus to implement an asynchronous Modbus TCP server on a BeagleBone Black. It works well, I'm able to connect with clients and retrieve values from the registers.

I start the server with:

from pymodbus.server.async import StartTcpServer

StartTcpServer(context, identity=identity, address=("0.0.0.0", 502))

I'm now trying to implement a monitor of the traffic in and out the server. I would need to plot/log all the requests from the client(s) and all the responses from the server.

Is there any way to access the rx/tx buffers?

Thank you.

Benyamin Jafari
  • 27,880
  • 26
  • 135
  • 150

1 Answers1

0

You could enable logging as debugging mode for Modbus server as follows:

import logging
FORMAT = ('%(asctime)-15s %(threadName)-15s'
          ' %(levelname)-8s %(module)-15s:%(lineno)-8s %(message)s')
logging.basicConfig(format=FORMAT)
log = logging.getLogger()
log.setLevel(logging.DEBUG)

Here's the original example.

Benyamin Jafari
  • 27,880
  • 26
  • 135
  • 150
  • Thank you Benyamin but that's way too many information to parse/log. You get an entry for any event happening. I really need just to access the buffers where the in/out messages are stored. – marcorto Jan 10 '20 at 09:46