LocateRegistry中没有带此签名的方法。你可以使用这种形式的 方法创建一个绑定到特定IP地址的 注册表对象: public static Registry createRegistry(int port,RMIClientSocketFactory csf, RMIServerSocketFactory ssf)抛出RemoteException 你必须提供一个实现RMIServerSocketFactory的类 接口(RMIClientSocketFactory parm可以为null);这个类将 创建一个ServerSocket,你必须绑定到所需的IP地址。 这是一个例子: import java.rmi.server。*; import java.io. *; import java.net。*; public class AnchorSocketFactory扩展了RMISocketFactory实现 Serializable { private InetAddress ipInterface = null; public AnchorSocketFactory(){} public AnchorSocketFactory(InetAddress ipInterface) { this.ipInterface = ipInterface; } public ServerSocket createServerSocket(int port) { ServerSocket serverSocket = null; try { serverSocket = new ServerSocket(port,50,ipInterface); } catch(例外e) { System.out.println(e); } return(serverSocket); } public Socket createSocket(String dummy,int抛出IOException { return(新套接字(ipInterface,port)); } public boolean equals(Object that) { return(that!= null&& that.getClass()== this.getClass()); } } 在你的代码中执行以下操作: AnchorSocketFactory sf = new AnchorSocketFactory(< your InetAddress>); LocateRegistry.createRegistry(port,null,sf); HTH Alex Molochnikov 格式塔公司 www.gestalt.com Alex, $ b终端主机为每个活动的IP地址保留多个端口。 来自NIC卡的数据被传递到协议栈,并且来源 ip地址已被丢弃到达端口的时间。 您可以尝试在单个端口上侦听单个RMI服务器,将 数据传递给基于jvm的给定实例客户ID。 Sam90Alex,I doubt an end host keeps multiple ports for each active ip address.Data from a nic card is passed up the protocol stack, and the sourceip address has been discarded by the time it reaches the port.You might try a single RMI server listening on a single port, passingdata to a given instance of a jvm based on customer id.Sam90 Sam,在ASP环境中,需要单独使用 每个客户的实例。 Alex Molochnikov给了我正在寻找的答案,这是: LocateRegistry中没有方法这个签名。你可以使用这种形式的 方法创建 a注册表对象绑定到特定的IP地址: public static Registry createRegistry (int port,RMIClientSocketFactory csf,RMIServerSocketFactory ssf)抛出RemoteException 谢谢Alex M.等人!Sam, in an ASP environment, it is a requirement to have seperateinstances for each client.Alex Molochnikov gave me the answer I was looking for, which was:There is no method in LocateRegistry with this signature. You can createa Registry object bound to a specific IP address using this form of themethod:public static Registry createRegistry(int port, RMIClientSocketFactorycsf,RMIServerSocketFactory ssf) throws RemoteExceptionThanks Alex M. et al.! 这篇关于RMI绑定到SAME端口但在SAME主机上有不同的IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-03 18:04