android java.net.BindException: bind failed: EADDRINUSE (Address already in use)
来源:互联网 发布:适合高中生的淘宝店铺 编辑:程序博客网 时间:2024/05/01 01:01
今天遇到一种情况,在手机上发广播包,在4.4.2上的手机会发生,4.1.2和4.0.2都没有遇见,问题是这样的
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));
}
问题就解决了
0 0
- java.net.BindException: bind failed: EADDRINUSE (Address already in use)
- java.net.BindException: bind failed: EADDRINUSE (Address already in use)
- java.net.BindException: bind failed: EADDRINUSE (Address already in use)
- java.net.BindException: bind failed: EADDRINUSE (Address already in use)
- Android 关于java.net.BindException: bind failed: EADDRINUSE (Address already in use)
- android java.net.BindException: bind failed: EADDRINUSE (Address already in use)
- {已经解决}android java.net.BindException: bind failed: EADDRINUSE (Address already in use)
- java.net.BindException: bind failed: EADDRINUSE (Address already in use)解决办法
- java.net.BindException: Address already in use (Bind failed)
- java.net.BindException: Address already in use: Cannot bind
- java.net.BindException: Address already in use: bind
- java.net.BindException: Address already in use: bind
- Caused by: java.net.BindException: Address already in use: bind
- java.net.BindException: Address already in use: bind
- Netty报java.net.BindException: Address already in use: bind
- android socket bind错误 EADDRINUSE (Address already in use)
- java.net.BindException: Address already in use
- Tomcat启动时报java.net.BindException:Address already in use:JVM Bind:8443错误的解决方法
- 对Android项目中的文件夹进行解释
- arcgis api for flex 鹰眼 可动态缩放
- centos下apache多域名单ip配置
- Internet应用技术与Html课程总结
- shell获取时间
- android java.net.BindException: bind failed: EADDRINUSE (Address already in use)
- 基于 Web 的 Go 语言 IDE - Wide 1.1.0 发布!
- iOS开发UIImage和UIImageView属性介绍,实现图片动画,实现开始/停止按钮效果
- Android Activity和Fragment的转场动画
- 字符串相关操作
- Linux中find常见用法示例
- Unity鼠标事件
- EasyPoi 如何筛选导出属性
- 正则表达式30分钟入门教程