📄 myrmiclient.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 + -