From ce09d6d4e69ea70046e2930ebd94bc0d92579778 Mon Sep 17 00:00:00 2001 From: Scott Petersen Date: Wed, 22 May 2013 10:17:13 -0700 Subject: [PATCH] Renamed _socket to _device for consistencys sake --- pyad2usb/devices.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pyad2usb/devices.py b/pyad2usb/devices.py index 2db10ad..b038b70 100644 --- a/pyad2usb/devices.py +++ b/pyad2usb/devices.py @@ -386,7 +386,7 @@ class SocketDevice(Device): """ self._host = "localhost" self._port = 10000 - self._socket = None + self._device = None self._buffer = '' self._running = False @@ -406,8 +406,8 @@ class SocketDevice(Device): self._host, self._port = interface try: - self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - self._socket.connect((self._host, self._port)) + self._device = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self._device.connect((self._host, self._port)) except socket.error, err: self.on_close() @@ -426,8 +426,8 @@ class SocketDevice(Device): try: self._read_thread.stop() - self._socket.shutdown(socket.SHUT_RDWR) - self._socket.close() + self._device.shutdown(socket.SHUT_RDWR) # Make sure that it closes immediately. + self._device.close() except: pass @@ -443,7 +443,7 @@ class SocketDevice(Device): """ Writes data to the device. """ - data_sent = self._socket.send(data) + data_sent = self._device.send(data) if data_sent == 0: raise util.CommError('Error while sending data.') @@ -456,7 +456,7 @@ class SocketDevice(Device): """ Reads a single character from the device. """ - return self._socket.recv(1) + return self._device.recv(1) def read_line(self, timeout=0.0): """ @@ -468,7 +468,7 @@ class SocketDevice(Device): try: while self._running: - buf = self._socket.recv(1) + buf = self._device.recv(1) if buf != '': self._buffer += buf