From ea7fa43edabcca496016c72e3e66209fa442144b Mon Sep 17 00:00:00 2001 From: Oliver Petschick Date: Mon, 16 Oct 2023 10:13:13 +0200 Subject: [PATCH] (fix): fixed tcpip_keepalive for TCPIPSocketSession (#396) (#397) * (fix): fixed tcpip_keepalive for TCPIPSocketSession * updated CHANGES.md to fix * fixed mypy issues --------- Co-authored-by: Oliver Petschick --- CHANGES | 1 + pyvisa_py/tcpip.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index c2b3ee42..6a454f71 100644 --- a/CHANGES +++ b/CHANGES @@ -9,6 +9,7 @@ PyVISA-py Changelog - fix missing sock.close() in rpc _connect() - fix HiSLIP message tracking after read timeout PR #376 - handle read_termination of null in tcipip PR #394 +- fix tcpip keepalive PR #396 0.7.0 (05/05/2023) ------------------ diff --git a/pyvisa_py/tcpip.py b/pyvisa_py/tcpip.py index 6a6d04dd..b874c174 100644 --- a/pyvisa_py/tcpip.py +++ b/pyvisa_py/tcpip.py @@ -1345,9 +1345,9 @@ def _set_tcpip_keepalive( self.interface.setsockopt( socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1 if attribute_state else 0 ) - self.interface.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, 60) - self.interface.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPINTVL, 60) - self.interface.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPCNT, 5) + self.interface.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, 60) + self.interface.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPINTVL, 60) + self.interface.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPCNT, 5) return StatusCode.success return StatusCode.error_nonsupported_attribute