Converted improvised timeouts to proper read and write timeouts.