EADDRNOTAVAIL 为(Cannot assign requested address)
最近使用udp,在使用socket和packet的时候会出现java.net.BindException: bind failed: EADDRNOTAVAIL(Cannot assign request address)
有两种可能:
(1)ip有误,一定要区分手机的ip和电脑的ip。。。。
(2)手机没网络。。。。呵呵
其实可以在程序中自己写一个自动获取手机ip 的函数,自行百度~~~