This looks correct. I am wondering if we should not subtract timeout by the time already spent in this function. Makes no sense starting a read of a large packet with almost no time left.