zt
09/12/2022, 1:09 AMwriteShort
but that's for signed intephemient
09/12/2022, 2:08 AMwriteShort(ushort.toShort())
, UShort
and Short
have the same representationephemient
09/12/2022, 2:11 AMzt
09/12/2022, 2:20 AMzt
09/12/2022, 2:40 AMzt
09/12/2022, 4:06 AMval readChannel = clientConnection.openReadChannel()
val sendChannel = clientConnection.openWriteChannel(autoFlush = true)
val authName = ""
val authData = ""
fun BytePacketBuilder.writePadding(bytes: Int) {
repeat((4 - bytes % 4) % 4) { writeByte(0) }
}
sendChannel.writePacket {
writeUByte(102u)
writeUByte(0u)
writeUShort(11u)
writeUShort(0u)
writeUShort(authName.length.toUShort())
writeUShort(authData.length.toUShort())
writeUShort(0u)
writeText(authName)
writePadding(authName.length)
writeText(authData)
writePadding(authData.length)
}
println(readChannel.readByte())
It just throws Uncaught Kotlin exception: <http://io.ktor.utils.io|io.ktor.utils.io>.errors.EOFException: 1 bytes required but EOF reached
at the readByte call