public StmConfig updateConfiguration(StmConfig stmConfig) { WebClient client = new WebClient(); byte[] response = client.UploadData("http://" + stmConfigAddress.ToString() + "/config", "PUT", Encoding.ASCII.GetBytes(stmConfig.toString())); String responseString = System.Text.Encoding.UTF8.GetString(response); LastConfiguration = StmConfig.parse(responseString); return(LastConfiguration); }
public async Task <StmConfig> getConfiguration() { HttpClient client = new HttpClient(); client.Timeout = TimeSpan.FromSeconds(2); HttpResponseMessage responseMsg = await client.GetAsync("http://" + stmConfigAddress.ToString() + "/config"); responseMsg.EnsureSuccessStatusCode(); string responseString = await responseMsg.Content.ReadAsStringAsync(); client.Dispose(); LastConfiguration = StmConfig.parse(responseString); return(LastConfiguration); }