I have a Java NIO socket server.
The server is getting JSONObjects
from remote clients.
i'm using the SocketChannel.read(ByteBuffer)
method in order to read from the channel.
each message ends with '\n' which marks the end of the current message.
my problem is that sometimes the read()
method read more bytes and reach after the '\n'..
is there a way for me to read from the SocketChannel
only until the '\n' is found ? i thought about maybe byte by byte read (i just couldn't find documents on how to implement it..)?
any other solutions ?