readPacketAtMost

fun ReadableByteChannel.readPacketAtMost(n: Long): <Error class: unknown class>

Read a packet of at most n bytes. Resulting packet could be empty however this function always reads as much bytes as possible. You also can use it with non-blocking channels