I am using the SocketChannel
Java class for a client/server application. I can send and retrieve data. But if my data contains '\n'
then I do not read the correct data. For example
sending data = "Hi dear"
receiving data = "Hi dear"
sending data = "Hi dear\n\n i am fine"
receiving data = "Hi dear"
sending data = "Hi dear\\n\\n i am fine"
receiving data = "Hi dear\n\n i am fine"
ByteBuffer byteBuffer = ByteBuffer.allocate(BUFSIZE);
int nbytes = socketChannel.getChannel().read(byteBuffer);
I am using US-ASCII decoding. How can I overcome this type of problem?
Thanks, Deepak