Wednesday, March 18, 2015

java.net.preferIPv4Stack : IPV4 versus IPV6

See the whole documentation here https://docs.oracle.com/javase/7/docs/api/java/net/doc-files/net-properties.html

If you have a process listening on a Socket which is IPv6- enabled, you should see this by doing "ss -ln":

tcp LISTEN 0 100 ::ffff:192.168.6.210:7003 :::*

If the socket is enabled only for IP4, you should see:

tcp LISTEN 0 100 192.168.6.110:7003 *:*



Passing the -Djava.net.preferIPv4Stack=true property to the JVM forces the ServerSocket to bind to a IPV4 address - not sure why you want to do this anyway.

No comments: