雨翔河
首页
列表
关于
组播通信出现 SocketException 异常
2019-01-24 15:00
组播通信出现`Can't assign requested address`的`SocketException`异常 报错信息如下: ``` java.net.SocketException: Can't assign requested address at java.net.PlainDatagramSocketImpl.join(Native Method) at java.net.AbstractPlainDatagramSocketImpl.join(AbstractPlainDatagramSocketImpl.java:179) at java.net.MulticastSocket.joinGroup(MulticastSocket.java:323) at net.yuxianghe.Listener.main(Listener.java:21) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140) Process finished with exit code 0 ``` 解决方案: 启动的时候VM options加入: `-Djava.net.preferIPv4Stack=true` 或者去配置一个ipv6的组播地址. 这样问题就解决了。
类型:工作
标签:socket,组播,java
Copyright © 雨翔河
我与我周旋久
独孤影
开源实验室