How does a server program access this list of files |
directory_iterator
or recursive_directory_iterator
. how do you send the contents of a particular file |
ifstream::read
), send the buffer to the client (e.g. with boost::asio::write
or boost::asio::async_write
). There are some nice shortcuts, e.g. if you're using TCP streams, it's the one-liner tcp << file.rdbuf()
.. but you didn't mention whether you're using asio or something else. I strongly recommend asio, because it is also going to become part of standard C++ (likely in the next revision after C++17). It also has many easy tutorials http://www.boost.org/doc/libs/release/doc/html/boost_asio/tutorial.html and examples http://www.boost.org/doc/libs/release/doc/html/boost_asio/examples/cpp11_examples.html