Added timeout to read functions. Returns -1 on timeout.