Reputation: 367
I need to return 0.0.0.0 for the bind IP of an UDP socket in Java. But I am not sure if I should return "0.0.0.0" (ipv4) or "::" (ipv6) for the host of my socket. Can I always return "0.0.0.0" and it will work? Or should I have to first find out if the machine I am running on is ipv4 or ipv6?
Upvotes: 4
Views: 160
Reputation: 311048
need to return 0.0.0.0 for the bind IP of an UDP socket in Java.
Why? Just use an InetAddress
of null.
It means the same thing, but it is IP-version-agnostic.
Upvotes: 2