On Linux, demultiplexing multiple sockets using epoll is the fastest way to parallel I / O over TCP.
But I also mentioned that in the interest of portability (and since you seem to be interested in Linux or Windows), you should look into Boost.Asio. It has a portable API, but uses epoll for Linux and overrides Windows I / O, so you can create high-performance and portable network applications.
In addition, since you are working with files, you must also implement double buffering when performing I / O operations for maximum performance. In other words, you send / recv each file using two buffers. For example, on the sending side, you read from the disk into one buffer, and then send this buffer over the network, and the other stream reads the next block of data from the disk to the second buffer. Thus, you overlap disk I / O with network I / O.
source share