readme

来自「this gives details of the network progra」· 代码 · 共 43 行

TXT
43
字号
Remote Sort RMI example code.
This example just shows that you can pass and return complex objects,
the other 2 examples just use simple data types. Here we pass a List to
a remote sort procedure.

RemoteSort.java is the definition of an interface that extends Remote. 

RemoteSortImpl.java is the implementation of the RemoteSort interface. This
class provides the actual remote sort method. In this example the RemoteSortImpl
class also includes a main() that creates a remote object and registers with the
naming service so clients can find it. 

RemoteSortImpl_Stub.class  and RemoteSortImpl_Skel.class are created by rmic
(the rmi compiler) based on the RemoteSortImpl class.

SortClient.java is the source for the client program. This client takes 1 command
line parameter - the hostname of the machine running the server.
The client reads everything it can from stdin and creates a list of the strings.
Then the client uses the remote sort object to sort this list (and return a new list);
The client prints out the resulting sorted list.

To run this example:

1. compile the files *.java
> javac *.java

2. Run the rmi compiler to generate the stubs and skeletons:
> rmic RemoteSortImpl

3. on the machine you want to run the server (the remote methods), start up
the RMI registry (for Windows systems you use "start" to put this in the background)
> start rmiregistry 

4. on the server machine you now run the server:
> java RemoteSortImpl


5. on the client machine you run the client, you can pipe in some text:

> type README | java SortClient servername 

(type is like cat for DOS).

⌨️ 快捷键说明

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