Is there any easy and memory-efficient way to skip the next
n bytes received on a
I am implementing a protocol in which messages have an optional payload with a length provided in the message header, and I want to be able to provide a reasonable error response when receiving a message that is too large for the service to handle. When such a message is received, the next message will come after the client has finished sending the entire too-large-to-handle payload, so somehow the protocol needs to ignore all the bytes in the payload (since they’re too large to read into memory).
Seek when its underlying reader implements seek, but
TcpStream does not.