关键代码:

try {

String str=Chat.getJt().getText().toString();//获取输入内容
String[] ipstr=str.split("[.]");
byte[] by=new byte[4];
for(int i=0;i<4;i++){
int m=Integer.parseInt(ipstr[i]);
byte b=(byte)(m&0xff);
by[i]=b;
}
InetAddress inet=InetAddress.getByAddress(by);
String pc=inet.getHostName();

} catch (UnknownHostException e) {
// TODO 自动生成的 catch 块
e.printStackTrace();
}

相关文章:

  • 2022-01-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-24
  • 2021-12-19
  • 2022-02-13
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
  • 2021-11-27
  • 2022-12-23
相关资源
相似解决方案