On Tue Nov 30, 2021 at 11:20 PM CET, LastName Almaember wrote: > It's meant to first read a nine-byte header (8 bits of a type field > followed by a 64 bit length). In theory, it should work fine, but it > always immediately returns InputTooShort (right at the first check).
io.Readers returns up to len(p), not exactly len(p), you have to loop over calling read until you have enough input, there's io.ReadAtLeast and io.ReadFull helpers that does that for you. > A bufio *might* work for this, however, I'm not confident that it will > respect the deadline set on the connection. > bufio will respect your deadline, it doesn't skip errors from the underlying reader, just returns them up. I suspect that it doesn't solve the issue mentioned above tho. BR. -w -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CG3S8W6WU9LX.1XINQC5EZN91Q%40pampas.