Reputation: 23
I have a device wich send TCP packets with 1440byte payload very fast to Windows XP os. I set the TcpAckFrequency to be 0, i.e. send ACK immediately back after a package received. I wrote a Java application which read in a thread the socket with:
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
in.read(charArray, 0, 720);
My problem is that Windows buffer become full after some (50-60)packet received, after that send a DUP ACK which slows down the communication.
I don't understand why become it full, as i always reading the buffer?
Upvotes: 0
Views: 1946
Reputation: 718826
One possible explanation is that the Java application is not able to keep up. In other words, it can't process the data as fast at the device is sending it. If that is the problem, you have to come up with a solution that lets the application process the data faster.
If you have multiple cores, you may be able to get better thoughput by refactoring the Java application to use one thread to read the data from the socket, and another thread (or threads) to do the processing.
Another solution might simply be to profile the Java application to see if there is scope for tuning optimization.
Finally, you might be able to improve throughput by using a larger buffer size for the BufferedReader
.
Upvotes: 1