'ContinousPosting using HttpClient c#

Suppose, I would like to to keep sending data into the Network stream using Httpclient Can I use PostAsync() method for that for such purposes where the user can keep sending the data over network stream in a while loop.

To illustruate below is the code ,

     private HttpClient Client;
     public void HttpClientUI()
     {
      Client = new HttpClient();
      while(true)
       { 
      Client.BaseAddress = "http://127.0.0.1:3432"
       PostToServer();
       }
     }
     public void PostToServer()
     {
      Client.PostAsync("/MovieData",newStringContent("Hello from Client",Encoding.UTF8))
     }

On the other hand, what other ways I can use to keep pushing data to the Server and read it from Server end. Also , suggest any documents or concept to explore.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source