Check for timeout when reading. Added more error checking. Some housekeeping to make it easier to follow the code, name changes and more descriptive comments. r3785 | ffr | 2012-11-05 12:20:41 +1100 (Mon, 05 Nov 2012) | 5 lines
r3359 | ffr | 2012-01-30 11:09:25 +1100 (Mon, 30 Jan 2012) | 2 lines