title: How do I post large ammount of bytes that I recieve from network to a web server?
body: <p>Hi I have a binary data that I recieve from network connection I have, I would like to sending those data in a HttpClient post.</p>
  
  <p>So far I have created this example which does not work</p>
  
  <pre><code>using (HttpClient httpClient = new HttpClient())
  {
      MemoryStream outputStream = new MemoryStream();
      StreamContent content = new StreamContent(outputStream);
      content.Headers.Add("Content-Type", "application/octet-stream");
  
      var request = new HttpRequestMessage(HttpMethod.Post, "api/v1/media/frames");
      request.Content = content;
  
      var response = await httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead);
  
      byte[] buffer = new byte[4];
  
      while (true)
      {
          await outputStream.WriteAsync(new byte[4] { 4, 4, 4, 4 }, 0, 4);
          await Task.Delay(500);
      }
  }
  </code></pre>
  
  <p>This does not work and it seems that it does not work because I'm writing data to a memory stream after I send post. Is there a way to do that? The only think I can think of is to implement my own stream which will block reading until there is something to read... Is there something similar in .net?</p>
  
  <p>Thank you very much for your help.</p>