java rmi -Djava.rmi.server.hostname = localhost仍会打开一个监听0.0.0.0的套接字 [英] java rmi -Djava.rmi.server.hostname=localhost still opens a socket listening on 0.0.0.0

查看:7872
本文介绍了java rmi -Djava.rmi.server.hostname = localhost仍会打开一个监听0.0.0.0的套接字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 -Djava.rmi.server.hostname = localhost 选项仅在localhost上进行rmi侦听,但netstat显示套接字正在侦听 0.0.0.0

I use the -Djava.rmi.server.hostname=localhost option to make rmi listen on localhost only, but netstat shows the socket is listening on 0.0.0.0.

奇怪的是RMI RenewClean线程显示它使用localhost。例如。 RMI RenewClean- [localhost:59357]

The strange thing is that the RMI RenewClean thread shows its using localhost. E.g. RMI RenewClean-[localhost:59357]

我认为如果我设置 -Djava.rmi.server.hostname = localhost 它应该只是收听127.0.0.1

I assumed that if I set -Djava.rmi.server.hostname=localhost it should only be listening on 127.0.0.1

我是否误解了java.rmi.server.hostname控制的内容?

Am I misunderstanding what java.rmi.server.hostname controls?

推荐答案


我假设如果我设置-Djava.rmi.server.hostname = localhost,那么
只能在127.0.0.1上监听

I assumed that if I set -Djava.rmi.server.hostname=localhost it should only be listening on 127.0.0.1

否。


我误解了java.rmi.server .hostname控件?

Am I misunderstanding what java.rmi.server.hostname controls?

是的。 java.rmi.server.hostname 与远程对象侦听的IP地址无关。这是由 RMIServerSocketFactory确定的。

Yes. java.rmi.server.hostname has nothing whatsoever to do with what IP address the remote object listens on. That is determined by the RMIServerSocketFactory.

要在另一个答案(随后删除)中纠正我的书中的错误引用:

To correct the misquotation from my book in another answer (subsequently deleted):


java.rmi.server.hostname:主机名字符串;默认值是本地主机的dotted-quad格式的IP地址...当导出远程对象时,它嵌入到由此JVM创建的远程存根中。这可用于控制多宿主主机导出的RMI服务器的有效IP地址。这个属性在JVM的生命周期中只读取一次。[1]

java.rmi.server.hostname: Hostname string; default value is the local host's IP address in "dotted-quad" format ... which is embedded into remote stubs created by this JVM when remote objects are exported. This can be used to control the effective IP address of RMI servers exported by multi-homed hosts. This property is read exactly once in the life of the JVM.[1]

为了扩展它,它也可以用于控制NAT设备后面的主机导出的RMI服务器的有效IP地址(由客户端看到)。它不一定与本地主机有任何关系,例如在NAT情况下,它可以是主机名,点分四IPv4地址或IPv6地址。

To expand on that, it can also be used to control the effective IP address (as seen by clients) of RMI servers exported by hosts that are behind NAT devices. It doesn't necessarily have anything to do with the local host, e.g. in NAT situations, and it can be either a hostname, a dotted-quad IPv4 address, or an IPv6 address.

[1] Pitt& McNiff, java.rmi,远程方法调用指南, Addison Wesley 2001,第258页。

[1] Pitt & McNiff, java.rmi, The Remote Method Invocation Guide, Addison Wesley 2001, p.258.

这篇关于java rmi -Djava.rmi.server.hostname = localhost仍会打开一个监听0.0.0.0的套接字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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