I wanted to test which method I should use for performing network communication for my Android app. I want fastest network communication.
How should I test these two methods java.net
and java.nio
for my mobile app to get to the conclusion.
Any pointers ?
Unless you're writing a server that expects to have tens of thousands of incoming connections there is no reason to prefer
java.nio
overjava.net
, and the latter is very much simpler to program.I did very extensive benchmark testing with 1700 data points some years ago, which inter alia proved there was no performance difference between
java.net
andjava.nio
over single Internet connections.