服务热线:13616026886

技术文档 欢迎使用技术文档,我们为你提供从新手到专业开发者的所有资源,你也可以通过它日益精进

位置:首页 > 技术文档 > JAVA > 新手入门 > 基础入门 > 查看文档

解决java网络编程ipv6带来的问题方法



    以前用jgroups以及mantaray都碰到过这样的问题,蹩脚的做法禁止ipv6协议,今天学到的一招解决网络编程ipv6带来的问题!设置一个属性就可以了   -djava.net.preferipv4stack=true   以后用jgroups可以设置一下就可以了,查阅sun官方文档解释如下:

   java.net.preferipv4stack (default: false) if ipv6 is available on the operating system the underlying native socket will be an ipv6 socket. this allows java(tm) applications to connect too, and accept connections from, both ipv4 and ipv6 hosts. if an application has a preference to only use ipv4 sockets then this property can be set to true. the

扫描关注微信公众号