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

Fix: ip instrument log empty responce and ensure all data is send #719

Merged
merged 3 commits into from
Sep 19, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions qcodes/instrument/ip.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
"""Ethernet instrument driver class based on sockets."""
import socket
import logging

from .base import Instrument

log = logging.getLogger(__name__)

class IPInstrument(Instrument):

Expand Down Expand Up @@ -139,10 +141,14 @@ def set_terminator(self, terminator):

def _send(self, cmd):
data = cmd + self._terminator
self._socket.send(data.encode())
self._socket.sendall(data.encode())

def _recv(self):
return self._socket.recv(self._buffer_size).decode()
result = self._socket.recv(self._buffer_size)
if result == b'':
log.warning("Got empty response from Socket recv() "
"Connection broken.")
return result.decode()

def close(self):
"""Disconnect and irreversibly tear down the instrument."""
Expand Down