public ActionResult ip() { ip publicip = new ip(); var client = new HttpClient(); var response = client.GetAsync("http://ip-api.com/json"); response.Wait(); var result = response.Result; if (result.IsSuccessStatusCode) { var readTask = result.Content.ReadAsStringAsync(); readTask.Wait(); ip ip3 = JsonConvert.DeserializeObject <ip>(readTask.Result); publicip = ip3; } string ip = HttpContext.Request.UserHostAddress; if (string.IsNullOrEmpty(ip) || ip == "::1") { string hostName = Dns.GetHostName(); IPHostEntry myIP = Dns.GetHostEntry(hostName); IPAddress[] address = myIP.AddressList; ip = address[2].ToString(); } ViewBag.ip = ip; ViewBag.ip2ip = publicip.query; ViewBag.ip2c = publicip.country; ViewBag.ip2s = publicip.regionName; ViewBag.ip2ci = publicip.city; ViewBag.ip2z = publicip.zip; return(PartialView("ip")); }
public HttpServer(IPAddress ip, int port) => m_Listener = new TcpListener(ip, port);
=> _repo = new RemoteRepository(ip, port);
LoggingFactory.GetLogger().Debug(ip, message);
var(ip, acc) = state;