Completion Time: 2006-11-7
Today, I accidentally discovered a small Java course assignment.
- Program Introduction
This is a file transfer program implemented by using the RMI technology of the Java platform, which is divided into two parts: the server side and the client side.
- Source code
A total of four files are located in the SRC \ tqyrmi \ Folder: mylog. Java, ifiletransport. Java, filetransportserver. Java, filetransportclient. Java
View Source Code
- Executable program
Server program: bin \ filetransportserver. Jar
Client Program: bin \ filetransportclient. Jar
- Running Environment
Jre1.5.0 needs to be installed
- Compile
1) first install JDK and set the PATH environment variable.
2) Start the console and go to the src directory.
3) javac tqyrmi \ *. Java
4) rmic tqyrmi. filetransportserver. filetransportimpl
- Run
The program has been packaged into a jar file on the eclipse platform. Therefore, if jre1.5.0 is installed, double-click filetransportserver. jar and filetransportclient. jar to run the program.
- Running result
Server:
Client:
- Program Structure Analysis
1) Remote Call interface (ifiletransport Interface)
It specifies the default port, as well as three interfaces: getting the shared file list, getting the file length, and getting the file content.
2) server (filetransportserver. Java)
Filetransportserver class implements the server interface. Its internal class filetransportimpl implements the ifiletransport interface.
3) client (filetransportclient)
The filetransportclient class implements the client functions.
4) Others (mylog)
Mylog is a custom log record class.