RMI远程服务操作

来源:互联网 发布:linux解压gz文件命令 编辑:程序博客网 时间:2024/06/05 10:37

//接口继承 Remote (才能开启服务)

//接口实现继承  UnicastRemoteObject(必须, 序列化)
interface i=new interface implements();
LocateRegistry.createRegistry(8080);(注册端口号)
Naming.bind("rmi://192.0.0.1/web", i);(注册通讯路径和绑定)

// 获取转换 interface  in=(interface )Naming.lookup("rmi://192.0.0.1/web");(rt.jar包下)

  //调用获取数据   in.Method();

原创粉丝点击