0
我想構建一個服務器,該服務器可通過網絡內的Wifi進行搜索。因此,服務器應發送UDP數據報,以發佈其存在。Java getNetworkPrefixLength()始終爲-1在WLAN棒上
在我的電腦上有一個WLAN棒。與Java的NetworkInterface和InterfaceAddress的方法讀出的信息給我了以下信息:
300Mbps Wireless USB Adapter
interface InetAddress: /192.168.43.16
interface address string in textual presentation: 192.168.43.16
network prefix length: -1
broadcast InetAddress: /96.113.104.12
broadcastAddress: 96.113.104.12
300Mbps Wireless USB Adapter
interface InetAddress: /192.168.43.16
interface address string in textual presentation: 192.168.43.16
network prefix length: -1
broadcast InetAddress: /0.0.0.0
broadcastAddress: 0.0.0.0
Exception in socket discovery beacon send thread.
爲什麼會收到多個廣播地址相同的InetAddress?
使用我的Windows PC上的ipconfig/all告訴我,我的子網掩碼是255.255.255.0。那麼通常網絡前綴長度應該是24,或者?