Java--网络编程(1)InetAddress实例化

实例化InetAddress:
1,getByName(String host)
2,getLocalHost

两个常用方法:

1,获取本机的地址 :

inet=InetAddress.getLocalHost();

2,获取域名:

inet=InetAddress.getHostName();
发布了49 篇原创文章 · 获赞 0 · 访问量 1428

猜你喜欢

转载自blog.csdn.net/qq_43616001/article/details/104011053