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

📄 myrmiclient.java

📁 Long-distance rmi transfers java to realize may realize a service end many client side conversation
💻 JAVA
字号:
package com.antbang.rmilab;/* * To change this template, choose Tools | Templates * and open the template in the editor. *//** * * @author GAGA */import java.rmi.*;import java.util.Date;public class MyRMIClient{    public static void main(String[] argv)    {        String serverName = "127.0.0.1";        if (argv.length > 0)        {            serverName = argv[0];        }        try        {            //bind server object to object in client            MyRMIInterface myServerObject = (MyRMIInterface) Naming.lookup("rmi://" + serverName + "/myRMIImplInstance");            Date date = myServerObject.getDate();            System.out.println("Date on server is " + date);            String content = "this is the first message";            Message message = new Message(new Date(), content);            myServerObject.sendMessage(message);        }        catch (Exception e)        {            System.out.println("Exception occured: " + e);            System.exit(0);        }        System.out.println("RMI connection successful");    }}

⌨️ 快捷键说明

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