#145 Error in socket_connection.py

v2.6
closed-fixed
Chris Liechti
None
5
2013-10-17
2013-02-26
Jason Morgan
No

In the read() member function the loop is such that is looses data.
If the data length requested is more than 1, then unless the data is immediately available (i.e. the loop runs no more than one time)
then the first and subsequent read data is deleted.

Also, socket.recv() returns a string, so using a bytearray is pointless.

Required changes shown below:

--------------
#data = bytearray()
data = ""
...
#data = self._socket.recv(size - len(data))
data += self._socket.recv(size - len(data))
...

Discussion

  • Chris Liechti
    Chris Liechti
    2013-05-31

    OK, fixed. however the bytearray is needed as pySerial specifies to return bytes, not strings, on Python versions that make a difference there.

    fix will be in release 2.7

     
  • Chris Liechti
    Chris Liechti
    2013-05-31

    • status: open --> pending-fixed
    • assigned_to: Chris Liechti
    • Group: --> v1.0 (example)
     
  • Chris Liechti
    Chris Liechti
    2013-10-17

    • Group: v1.0 (example) --> v2.6
     
  • Chris Liechti
    Chris Liechti
    2013-10-17

    2.7 released

     
  • Chris Liechti
    Chris Liechti
    2013-10-17

    • status: pending-fixed --> closed-fixed