Edoardo Luppi
08/27/2023, 4:02 PMSocket.getInputStream().available()
to know the available bytes in the read buffer.
That buffer is 65k bytes, which more or less means I need a couple of iterations to read the entire server response.
I know it's a weird way to implement a protocol, but I can't do anything about it now.
With Ktor I find myself reading 4k bytes at a time (availableForRead
), which slows it down quite a bit, also because the buffer doesn't seem to be immediately refilled.
Is there a way I can use an arbitrary size for that buffer? I'm not sure your answer there applies here.Edoardo Luppi
08/27/2023, 6:26 PMByteReadChannel
has a readUTF8Line
method. Which is mostly what I'd need.
However my protocol doesn't operate using UTF-8, but using charsets like CP037 or CP1047.
Could I implement my own readLine
method - that doesn't decode the byte stream - using utilities that are already present?e5l
08/28/2023, 3:53 PMEdoardo Luppi
08/28/2023, 3:58 PMEdoardo Luppi
08/28/2023, 3:58 PM