private string GetStats(RailgunInstance i) { string json; var req = (HttpWebRequest) WebRequest.Create(string.Format("http://{0}:{1}/", i.Host, i.Port)); using (var resp = req.GetResponse()) using (var rs = resp.GetResponseStream()) { if (rs == null) return null; using (var sr = new StreamReader(rs)) { json = sr.ReadToEnd(); } } return json; }
private async Task<string> GetStats(RailgunInstance i) { string json; var req = (HttpWebRequest) WebRequest.Create($"http://{i.Host}:{i.Port}/"); using (var resp = await req.GetResponseAsync()) using (var rs = resp.GetResponseStream()) { if (rs == null) return null; using (var sr = new StreamReader(rs)) { json = sr.ReadToEnd(); } } return json; }
private async Task <string> GetStats(RailgunInstance i) { string json; var req = (HttpWebRequest)WebRequest.Create($"http://{i.Host}:{i.Port}/"); using (var resp = await req.GetResponseAsync()) using (var rs = resp.GetResponseStream()) { if (rs == null) { return(null); } using (var sr = new StreamReader(rs)) { json = sr.ReadToEnd(); } } return(json); }
private string GetStats(RailgunInstance i) { string json; var req = (HttpWebRequest)WebRequest.Create(string.Format("http://{0}:{1}/", i.Host, i.Port)); using (var resp = req.GetResponse()) using (var rs = resp.GetResponseStream()) { if (rs == null) { return(null); } using (var sr = new StreamReader(rs)) { json = sr.ReadToEnd(); } } return(json); }