readPacketAtMost

fun InputStream.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.