html1%5C01%5Cclip_filelist.xml" rel=File-List>
一、isAnyLocalAddress方法
当IP地址是通配符地址时返回true,否则返回false。这个通配符地址对于拥有多个网络接口(如两块网卡)的计算机非常拥有。使用通配符地址可以允许在服务器主机接受来自任何网络接口的客户端连接。IPv4的通配符地址是0.0.0.0。IPv6的通配符地址是0:0:0:0:0:0:0:0,也可以简写成::。
二、isLoopbackAddress方法
当IP地址是loopback地址时返回true,否则返回false。loopback地址就是代表本机的IP地址。IPv4的loopback地址的范围是127.0.0.0 ~ 127.255.255.255,也就是说,只要第一个字节是127,就是lookback地址。如127.1.2.3、127.0.200.200都是loopback地址。IPv6的loopback地址是0:0:0:0:0:0:0:1,也可以简写成::1。我们可以使用ping命令来测试lookback地址。如下面的命令行所示:
ping
127.200.200.200
运行结果:
Reply from
127.0.0.1
: bytes
=
32
time<1ms TTL
=
128
Reply from 127.0.0.1 : bytes = 32 time<1ms TTL = 128
Reply from 127.0.0.1 : bytes = 32 time<1ms TTL = 128
Reply from 127.0.0.1 : bytes = 32 time<1ms TTL = 128
Ping statistics for 127.200.200.200 :
Reply from 127.0.0.1 : bytes = 32 time<1ms TTL = 128
Reply from 127.0.0.1 : bytes = 32 time<1ms TTL = 128
Reply from 127.0.0.1 : bytes = 32 time<1ms TTL = 128
Ping statistics for 127.200.200.200 :