1. 4

  2. 5

    The point is not that the interface is blocking but that streams are streams. You can’t rely on a non-blocking read interface to return chunks of data of any specific size. How you handle this is by adding a length field at the beginning, reading that, and then using ReadFull with that size.

    This is why DNS over UDP (datagrams) doesn’t have a length field, while it does over TCP (stream).