Java course assignments-use RMI for File Transfer

Source: Internet
Author: User

Completion Time: 2006-11-7

Today, I accidentally discovered a small Java course assignment.
  1. 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.
  2. 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
  3. Executable program
    Server program: bin \ filetransportserver. Jar
    Client Program: bin \ filetransportclient. Jar
  4. Running Environment
    Jre1.5.0 needs to be installed
  5. 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
  6. 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.
  7. Running result
    Server:

    Client:
  8. 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.