Java 多播生存时间始终为 0 [英] Java Multicast Time To Live is always 0

查看:24
本文介绍了Java 多播生存时间始终为 0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在设置数据报数据包的 TTL 时遇到问题.在将数据包发送到多播套接字之前,我正在对数据包调用 setTTL(...) 方法,但是如果我使用 ethereal 捕获数据包,则 TTL 字段始终设置为 0

I have a problem with setting the TTL on my Datagram packets. I am calling the setTTL(...) method on the packet before sending the packet to the multicastSocket but if I capture the packet with ethereal the TTL field is always set to 0

推荐答案

基本上,您必须设置一个特殊的系统属性,告诉 JVM 使用 IPv4 堆栈:

Basically you have to set an special system property telling the JVM to use an IPv4 stack:

-Djava.net.preferIPv4Stack=true

这篇关于Java 多播生存时间始终为 0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆