Hi everyone,
My sending messages may be larger than the default socket buffer size. So there may be several read operations in order to receive a complete message. When the end condition is
...
Type: Posts; User: perl0101
Hi everyone,
My sending messages may be larger than the default socket buffer size. So there may be several read operations in order to receive a complete message. When the end condition is
...
thank you.
socket is an instance of SocketChannel.
If I add an interval between messages, the problem is not there. I just feel that adding an interval may not be a good solution. Is there other ways?
Thank you. But the SocketChannel class just provide method to read a chunk, instead of byte by byte. Is there any way to read the header and get message size first. Then I can read the required...
For read:
n = socket.read(rbuf);
if (((n==0) || (n==-1))) {
logger.logInfo("t=" + t + " count=" + count + " and break."); //5-21-11
break;
}
For...
I am confused with my project.
It is a server/client system which uses java nio.
The requiremet is that the server keep sending 10 messages to the client. Then the client read messages. But the...
Thank you. It works.
Than you for your suggestions. I will experiment with it today.
I send messages through socket. For each read operation, several messags might be queued in a byte buffer at one time. I use a special character '^' which ascii value is 94 as a seperator. The...
Thanks for your suggestions in advance.
message delted