The main limiting factors, in order, are:
- Network bandwidth, by which I mean the bandwidth of the slowest part of the path between the peers.
- Size of the socket receive buffer at the receiver. If it is less than the bandwidth-delay product of the path, you won't be able to utilize the full available bandwidth.
- The speed at which you send. Contrary to a suggestion in the comments, you should send as much as possible at a time, and repeat as rapidly as you can, assuming blocking mode. In non-blocking mode it is considerably more complex, but if bandwidth utilization is your goal you're better off using blocking mode. You're probably also better off using
java.net
rather than NIO too.