欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Android 中出現(xiàn)java.net.BindException: bind failed: EADDRINUSE 問題解決辦法

 更新時間:2017年04月28日 10:12:58   投稿:lqh  
這篇文章主要介紹了Android 中出現(xiàn)java.net.BindException: bind failed: EADDRINUSE 問題解決辦法的相關資料,需要的朋友可以參考下

Android 中出現(xiàn)java.net.BindException: bind failed: EADDRINUSE 問題解決辦法

看下問題:

try{

DatagramSocket udpSocket = new DatagramSocket(DEFAULT_PORT );

} catch (Exception e)

{

e.printStackTrace();

}

//java.net.BindException: bind failed: EADDRINUSE (Address already in use)



解決方法:

將:udpSocket = new DatagramSocket(DEFAULT_PORT );

改為:

if(udpSocket==null){
udpSocket = new DatagramSocket(null);
udpSocket.setReuseAddress(true);
udpSocket.bind(new InetSocketAddress(DEFAULT_PORT));
}

問題就解決了

感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!

相關文章

最新評論