One of our Java program when started, it only listen on IPv6 (8080)
e.g.
# netstat -ntpl
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp6 0 0 :::8080 :::* LISTEN -
tcp6 0 0 :::22 :::* LISTEN -
The problem is it is not accessible from outside (except localhost), to solve this, I have this manually add
-Djava.net.preferIPv4Stack=true
But this make the program is only for IPv4 network.
Is it possible to do something like the sshd as above, both support IPv4 and IPv6?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…