amaliujia commented on code in PR #1637:
URL: https://github.com/apache/ratis/pull/1637#discussion_r4280768216
##########
ratis-common/src/main/java/org/apache/ratis/util/NetUtils.java:
##########
@@ -166,6 +166,19 @@ static String address2String(InetSocketAddress address) {
String LOCALHOST = "localhost";
+ /** IPv4 wildcard for binding a server to all local interfaces. */
+ String WILDCARD_ADDRESS = "0.0.0.0";
+
+ /**
+ * Creates a socket address for binding a server.
+ * When {@code host} is null or empty, uses {@link #WILDCARD_ADDRESS}
instead of
+ * {@code new InetSocketAddress(port)}, which may resolve to an IPv6
wildcard.
+ */
+ static InetSocketAddress createBindSocketAddress(String host, int port) {
+ return host == null || host.isEmpty() ?
+ createSocketAddrForHost(WILDCARD_ADDRESS, port) :
createSocketAddrForHost(host, port);
Review Comment:
Sure. try `-Djava.net.preferIPv4Stack=true` first.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]