You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2018/09/02 03:50:20 UTC

[GitHub] ralf0131 commented on issue #2423: Multicast demo fails with message "Can't assign requested address"

ralf0131 commented on issue #2423: Multicast demo fails with message "Can't assign requested address"
URL: https://github.com/apache/incubator-dubbo/issues/2423#issuecomment-417903024
 
 
   This is because there are multiple network interfaces in my macOS, both for ipv4 and ipv6:
   
   ```
   en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
           ether e0:ac:cb:7f:75:20
           inet6 fe80::cfb:9054:967d:13be%en0 prefixlen 64 secured scopeid 0x5
           inet 192.168.31.235 netmask 0xffffff00 broadcast 192.168.31.255
           nd6 options=201<PERFORMNUD,DAD>
           media: autoselect
           status: active
   awdl0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1484
           ether 62:32:71:46:6b:2e
           inet6 fe80::6032:71ff:fe46:6b2e%awdl0 prefixlen 64 scopeid 0x7
           nd6 options=201<PERFORMNUD,DAD>
           media: autoselect
           status: active
   ```
   
   `awdl0` is ipv6 only and `en0` is both ipv4 and ipv6 available. However the JVM selects `awdl0` as the default Network Interface in `java.net.DefaultInterface#getDefault()` method.  So if we use a ipv4 address for multicasting, the error will occur.
   
   If `-Djava.net.preferIPv4Stack=true` is specified, JVM will avoid choosing `awdl0` as default network interface. So everything will be all right.
   
   ### Enhancement
   
   Basically we don't want to let user to specify that vm args manually, so I'd like to propose to automatically select network interface by the input multicast address.
   
   If the multicast address is ipv4 address, automatically use ipv4 network address (by calling `java.net.MulticastSocket#setInterface()`), and vise versa.
    
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org