예제 #1
0
 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;
 }
예제 #2
0
 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;
 }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }