Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please implement a configurable timeout #29

Open
x8-999-github opened this issue May 18, 2018 · 1 comment
Open

Please implement a configurable timeout #29

x8-999-github opened this issue May 18, 2018 · 1 comment

Comments

@x8-999-github
Copy link

Hello,

I have successfully used the python-vxi11 on a rigol MSO1104z over TCP.
See
https://github.com/x8-999-github/cw-projects-experiments/blob/master/visa/Scope_arm_and_capture.ipynb and

https://github.com/x8-999-github/cw-projects-experiments/blob/master/visa/VXI_MSO1104z.ipynb

The main problem was a timeout I was getting when connecting.
Is it possible to make the socket timeout configurable(I hardcoed it here)?

#diff --git a/vxi11/rpc.py b/vxi11/rpc.py
#index 9d889a6..c744f8c 100644
#--- a/vxi11/rpc.py
#+++ b/vxi11/rpc.py
#@@ -257,6 +257,7 @@ class RawTCPClient(Client):
# 
#     def connect(self):
#         self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#+       self.sock.settimeout(2.0)
#         self.sock.connect((self.host, self.port))
# 
#     def close(self):
@emeryao
Copy link

emeryao commented Apr 7, 2022

import socket

socket.setdefaulttimeout(5.0)

the code above helps me out 😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants