title: http_listener cpprestsdk how to handle multiple POST requests
body: <p>I have developed a client server application with casablanca cpprestskd.
  Every 5 minutes a client send informations from his task manager (processes,cpu usage etc) to server via POST method.</p>
  
  <p>The project should be able to manage about 100 clients.
  Every time that server receives a POST request he opens an output file stream ("uploaded.txt") ,extract some initial infos from client (login,password),manage this infos, save all infos in a file with the same name of client (for example: client1.txt, client2.txt) in append mode and finally reply to client with a status code.
  This is basically my POST handle code from server side:</p>
  
  <pre><code>void Server::handle_post(http_request request)
  {
  
  auto fileBuffer = 
       std::make_shared&lt;Concurrency::streams::basic_ostream&lt;uint8_t&gt;&gt;();
  try
  {
      auto stream = concurrency::streams::fstream::open_ostream(
          U("uploaded.txt"),
          std::ios_base::out | std::ios_base::binary).then([request, fileBuffer](pplx::task&lt;Concurrency::streams::basic_ostream&lt;unsigned char&gt;&gt; Previous_task)
      {
  
          *fileBuffer = Previous_task.get();
          try
          {
              request.body().read_to_end(fileBuffer-&gt;streambuf()).get();
          }
          catch (const exception&amp;)
          {
              wcout &lt;&lt; L"&lt;exception&gt;" &lt;&lt; std::endl;
              //return pplx::task_from_result();
          }
          //Previous_task.get().close();
  
      }).then([=](pplx::task&lt;void&gt; Previous_task)
      {
  
  
          fileBuffer-&gt;close();
          //Previous_task.get();
      }).then([](task&lt;void&gt; previousTask)
      {
          // This continuation is run because it is value-based.
          try
          {
              // The call to task::get rethrows the exception.
  
              previousTask.get();
          }
          catch (const exception&amp; e)
          {
              wcout &lt;&lt; e.what() &lt;&lt; endl;
          }
      });
      //stream.get().close();
  }
  catch (const exception&amp; e)
  {
      wcout &lt;&lt; e.what() &lt;&lt; endl;
  }
  
  
  ManageClient();
  
  request.reply(status_codes::OK, U("Hello, World!")).then([](pplx::task&lt;void&gt; t) { handle_error(t); });
  return;
  
  }
  </code></pre>
  
  <p>Basically it works but if i try to send info from due clients at the same time sometimes it works sometimes it doen't work.
  Obviously the problem if when i open "uploaded.txt" stream file.
  Questions:</p>
  
  <p>1)Is CASABLANCA http_listener real multitasking?how many task it's able to handle?
  2)I didn't found in documentation ax example similar to mine,the only one who is approaching to mine is "Casalence120" Project but he uses Concurrency::Reader_writer_lock class (it seems a mutex method).
  What can i do in order to manage multiple POST?
  3)Is it possible to read some client infos before starting to open uploaded.txt?
  I could open an output file stream directly with the name of the client.
  4)If i lock access via mutex on uploaded.txt file, Server become sequential and i think this is not a good way to use cpprestsdk.
  I'm still approaching cpprestskd so any suggestions would be helpful.</p>