⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rmiclient.java

📁 用JAVA语言实现了RMI通信?肑AVA语言实现了RMI通信?肑AVA语言实现了RMI通信
💻 JAVA
字号:
/* * RMIClient.java * * Created on 2006年9月14日, 下午2:20 * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */package simplermi;import java.rmi.*;import java.util.ArrayList;/** * 客户端程序 * @author jiang */public class RMIClient{    public static void main(String[] args)    {           //为了测试 固定主机名称,端口号,命令        String host = "flzhu";        int port = 2200;        String cmd = "query";                MyRemoteInterface rmitest1;        ArrayList result1=null;                try        {            //通过查找注册表中的名字获取远程对象引用            rmitest1 = (MyRemoteInterface) Naming.lookup("//" + host + ":" + port + "/Manager");            //调用远程方法            result1=rmitest1.getFromDatabase(cmd);            if(result1!=null)            {                String response=(String)result1.get(0);                System.out.println(response);            }        }        catch(Exception nbe)        {            nbe.printStackTrace();        }    }    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -