Example #1
0
 /// <summary>
 /// 路由到游戏(发货)服务器
 /// </summary>
 /// <param name="url"></param>
 /// <returns></returns>
 public Variant Route(string url)
 {
     if (httpc == null)
     {
         httpc = new HttpClient("openid.gameflier.com", 80);
     }
     try
     {
         string result = httpc.Get(url);
         return JsonConvert.DeserializeObject<Variant>(result);
     }
     catch (System.Exception ex)
     {
         LogWrapper.Error(url + ex);
     }
     return null;
 }
Example #2
0
        private static void TestHttpClient()
        {
            IPEndPoint ep = new IPEndPoint(IPAddress.Parse("192.168.100.40"), 8200);
            HttpArgs arg = new HttpArgs();
            //arg.Body = "192.168.100.40";
            arg.Host = "192.168.100.40";
            arg.Url = "/gm?sig=32&cmd=noticeList&par=[\"dfs\",23,34]";
            byte[] getResult = HttpClient.Get(ep, arg);

            string xd = System.Text.Encoding.UTF8.GetString(getResult);
            Console.WriteLine(xd);

            HttpClient httpc = new HttpClient("192.168.100.40", 8200);
            string xd2 = httpc.Get(arg.Url);
            bool xd1Txd2 = (xd == xd2);
            Console.WriteLine(xd1Txd2);
        }