Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/341.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python pyModbus-TCPServer输入/输出流量监视器_Python_Modbus_Tcpserver_Modbus Tcp_Pymodbus - Fatal编程技术网

Python pyModbus-TCPServer输入/输出流量监视器

Python pyModbus-TCPServer输入/输出流量监视器,python,modbus,tcpserver,modbus-tcp,pymodbus,Python,Modbus,Tcpserver,Modbus Tcp,Pymodbus,我是python的新手。对不起,如果这个问题听起来很傻 我正在使用pyModbus在BeagleBone Black上实现一个异步Modbus TCP服务器。它工作得很好,我能够连接客户端并从寄存器中检索值 我使用以下命令启动服务器: from pymodbus.server.async import StartTcpServer StartTcpServer(context, identity=identity, address=("0.0.0.0", 502)) 我现在正试图实现一个服务

我是python的新手。对不起,如果这个问题听起来很傻

我正在使用pyModbus在BeagleBone Black上实现一个异步Modbus TCP服务器。它工作得很好,我能够连接客户端并从寄存器中检索值

我使用以下命令启动服务器:

from pymodbus.server.async import StartTcpServer

StartTcpServer(context, identity=identity, address=("0.0.0.0", 502))
我现在正试图实现一个服务器进出流量的监视器。 我需要打印/记录来自客户端的所有请求和来自服务器的所有响应

有没有办法访问rx/tx缓冲器


谢谢。

您可以启用
日志记录作为Modbus服务器的调试模式,如下所示:

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)

谢谢Benyamin,但这太多信息了,无法解析/记录。您将获得任何事件发生的条目。我真的需要访问存储输入/输出消息的缓冲区。