我的服务器代码如下所示:
Registry r = java.rmi.registry.LocateRegistry.createRegistry(1399);
r.rebind("Chat", new IRC());
我客户的代码是
IRCInterface remoteObject = (IRCInterface) Naming.lookup("rmi://localhost:1399/Chat");
String history = remoteObject.read();
在本地主机上它可以正常工作,但我无法连接两台远程计算机(主机)。我已经关闭了所有的防火墙。
怎么了?
控制台输出:
Error: java.rmi.ConnectException: Connection refused to host: 150.254.79.20; nested exception is:
java.net.ConnectException: Connection timed out: connect