gpt4 book ai didi

android - 我怎样才能得到我的外部/IP?

转载 作者:太空狗 更新时间:2023-10-29 15:36:46 24 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
How to get ip address of the device?

下面是我如何尝试获取外部 IP 的 fragment 。然而,它没有返回任何东西......

public String getIpAddress() {

try {
HttpClient httpclient = new DefaultHttpClient();
HttpGet httpget = new HttpGet("http://www.whatismyip.com/?404");
// HttpGet httpget = new HttpGet("http://whatismyip.com.au/");
// HttpGet httpget = new HttpGet("http://www.whatismyip.org/");
HttpResponse response;

response = httpclient.execute(httpget);

//Log.i("externalip",response.getStatusLine().toString());

HttpEntity entity = response.getEntity();
entity.getContentLength();
str = EntityUtils.toString(entity);
}
catch (Exception e)
{
}
return str;

}

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com