From a22932ef75b720048950dffeebf4b9160ac0fa0d Mon Sep 17 00:00:00 2001 From: dhoomakethu Date: Thu, 13 May 2021 11:03:15 +0530 Subject: [PATCH] #629 Add kwarg 'reset_socket' to disable closing sockets on error --- pymodbus/repl/client/main.py | 6 ++++-- pymodbus/repl/server/cli.py | 19 +++++++++++-------- pymodbus/transaction.py | 10 +++++++--- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/pymodbus/repl/client/main.py b/pymodbus/repl/client/main.py index bdfdea9e7..8dc5583c2 100644 --- a/pymodbus/repl/client/main.py +++ b/pymodbus/repl/client/main.py @@ -233,9 +233,10 @@ def _process_args(args, string=True): @click.option("--retry-on-error", is_flag=True, default=False, help="Retry on error response") @click.option("--retries", default=3, help="Retry count") +@click.option("--reset-socket/--no-reset-socket", default=True, help="Reset client socket on error") @click.pass_context def main(ctx, verbose, broadcast_support, retry_on_empty, - retry_on_error, retries): + retry_on_error, retries, reset_socket): if verbose: global log import logging @@ -248,7 +249,8 @@ def main(ctx, verbose, broadcast_support, retry_on_empty, "broadcast": broadcast_support, "retry_on_empty": retry_on_empty, "retry_on_invalid": retry_on_error, - "retries": retries + "retries": retries, + "reset_socket": reset_socket } diff --git a/pymodbus/repl/server/cli.py b/pymodbus/repl/server/cli.py index ebe442544..0ab1a96fd 100644 --- a/pymodbus/repl/server/cli.py +++ b/pymodbus/repl/server/cli.py @@ -25,7 +25,8 @@ | ___< | |/ \ / _ \ / __ | | __ \| | \/ ___/ \_____ \_/ __ \_ __ \ \/ // __ \_ __ \\ | | \___ | Y Y ( <_> ) /_/ | | \_\ \ | /\___ \ / \ ___/| | \/\ /\ ___/| | \/ |____| / ____|__|_| /\____/\____ | |___ /____//____ > /_______ /\___ >__| \_/ \___ >__| - \/ \/ \/ \/ \/ \/ \/ \/""" + \/ \/ \/ \/ \/ \/ \/ \/ +""" SMALL_TITLE = "Pymodbus server..." BOTTOM_TOOLBAR = HTML('(MODBUS SERVER)