remote control desktop report

Upload: sweetdream1028

Post on 03-Apr-2018

235 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 Remote control desktop report

    1/21

    Java Remote Desktop Control

    SVERIs College of Engg. (Poly), Pandharpur1

    Actual Client Desktop

    Screen shot client side

    Remote Image of the Connected Client Desktop

    Screen shot server side

  • 7/29/2019 Remote control desktop report

    2/21

    Java Remote Desktop Control

    SVERIs College of Engg. (Poly), Pandharpur2

    REQUIRMENTS SPECIFICATION

    4.1 HARDWARE SPECIFICATION

    Processor : Intel Pentium compatible or above

    RAM : 4MB free space

    VDU : VGA/ SV G A

    Hard Disk : 50 MB free space

    4.2 SOFTWARE SPECIFICATION

    Operating System : MS DOS / Windows 95/ Linux

    Programming language : Java2 ( JDK 1.2)

  • 7/29/2019 Remote control desktop report

    3/21

    Java Remote Desktop Control

    SVERIs College of Engg. (Poly), Pandharpur3

    DESIGN SPECIFICATION

    The proposed system is going to be developed using Java 2.java is platform independent.

    Thus it will run under any operating system like Windows or Linux. The system explorer is mainly

    concentrated on the development of an application that is used to explore computers in a network. The

    main part of the application is a GUI that is used to browse other machines in the network. The GUI

    should be developed using Java Swing.

    The system should be modularized into a client part and a server part so that each part could be

    run separately. The server part should acts as the file server for the local client as well as the remote

    server. The client part should provide a GUI for easy user interaction. All request from the client are

    passed to the local server only. Requests to the remote server are forwarded by the local sever.

  • 7/29/2019 Remote control desktop report

    4/21

    Java Remote Desktop Control

    SVERIs College of Engg. (Poly), Pandharpur4

    Background

    One of the biggest challenges in this project is finding a way to move the mouse pointer, simulate

    key stroke and capture the screen. After spending some time I found a great class, Robot class that

    does all that I need.

    In addition, using serialization to send screenshots from client to server and to send server events

    like mouse move, key press, key release helped me a lot to write clean and simple code instead of

    sending images and events in raw data format over the network.

    Robot Class Methods

    mouseMove - Moves the mouse pointer to a set of specified absolute screen coordinates given in

    pixels

    mousePress - Presses one of the buttons on the mouse

    mouseRelease- Releases one of the buttons on the mouse

    keyPress - Presses a specified key on the keyboard

    keyRelease - Releases specified key on the keyboard

    createScreenCapture - Takes a screenshot

  • 7/29/2019 Remote control desktop report

    5/21

    Java Remote Desktop Control

    SVERIs College of Engg. (Poly), Pandharpur5

    Program Parts

    1. RemoteServer

    This is the server part which waits for clients connections and per each connected client, a new frame

    appears showing the current client screen. When you move the mouse over the frame, this results inmoving the mouse at the client side. The same happens when you right/left click mouse button or

    type a key while the frame is in focus.

    2. RemoteClient

    This the client side, its core function is sending a screen shot of the client's desktop every predefined

    amount of time. Also it receives server commands such as "move the mouse command", then

    executes the command at the client's PC.

  • 7/29/2019 Remote control desktop report

    6/21

    Java Remote Desktop Control

    SVERIs College of Engg. (Poly), Pandharpur6

    Using the Code

    In order to run the program, you need to

    downloadRemoteServer_source.zipandRemoteClient_source.zipon two different PCs, then extract

    them. In one of the PCs say PC1, run RemoteServer.jarwhich is located under distfolder using the

    following command:

    Collapse |Copy Code

    >>java -jar RemoteServer.jar

    You will be asked to enter port number for the server to listen at, enter any port number above 1024,

    for example 5000.

    On the other PC say PC2, execute RemoteClient.jarusing the following command:

    Collapse |Copy Code>>java -jar RemoteClient.jar

    You will be asked to enter server IP, enter IP address of PC1, then you will be asked to enter port

    number, enter the same port you entered above, e.g. 5000.

    Now, in PC1 you have full control over PC2 including moving the mouse, clicking the mouse, keys

    stroking, viewing PC2 desktop, etc.

    http://www.codeproject.com/KB/IP/RemoteAdminJava/RemoteServer_source.ziphttp://www.codeproject.com/KB/IP/RemoteAdminJava/RemoteServer_source.ziphttp://www.codeproject.com/KB/IP/RemoteAdminJava/RemoteServer_source.ziphttp://www.codeproject.com/KB/IP/RemoteAdminJava/RemoteClient_source.ziphttp://www.codeproject.com/KB/IP/RemoteAdminJava/RemoteClient_source.ziphttp://www.codeproject.com/KB/IP/RemoteAdminJava/RemoteClient_source.ziphttp://www.codeproject.com/Articles/36065/Java-Remote-Desktop-Administrationhttp://www.codeproject.com/Articles/36065/Java-Remote-Desktop-Administrationhttp://www.codeproject.com/Articles/36065/Java-Remote-Desktop-Administrationhttp://www.codeproject.com/Articles/36065/Java-Remote-Desktop-Administrationhttp://www.codeproject.com/Articles/36065/Java-Remote-Desktop-Administrationhttp://www.codeproject.com/Articles/36065/Java-Remote-Desktop-Administrationhttp://www.codeproject.com/Articles/36065/Java-Remote-Desktop-Administrationhttp://www.codeproject.com/Articles/36065/Java-Remote-Desktop-Administrationhttp://www.codeproject.com/KB/IP/RemoteAdminJava/RemoteClient_source.ziphttp://www.codeproject.com/KB/IP/RemoteAdminJava/RemoteServer_source.zip
  • 7/29/2019 Remote control desktop report

    7/21

    Java Remote Desktop Control

    SVERIs College of Engg. (Poly), Pandharpur7

    Coding Structure

    RemoteServer

    ServerInitiator Class

    This is the entry class which listens to server port and wait for clients connections. Also, it creates an

    essential part of the program GUI.

    ClientHandler Class

    Per each connected client, there is an object of this class. It shows an InternalFrameper client and

    it receives clients' screen dimension.

    ClientScreenReciever Class

    Receives captured screen from the client, then displays it.

    ClientCommandsSender Class

    It listens to the server commands, then sends them to the client. Server commands include mouse

    move, key stroke, mouse click, etc.

    EnumCommands Class

    Defines constants which are used to represent server commands.

  • 7/29/2019 Remote control desktop report

    8/21

    Java Remote Desktop Control

    SVERIs College of Engg. (Poly), Pandharpur8

    RemoteClient

    ClientInitiator Class

    This is the entry class that starts the client instance. It establishes connection to the server and

    creates the client GUI.

    ScreenSpyer Class

    Captures screen periodically and sends them to the server.

    ServerDelegate Class

    Receives server commands and executes them in the client PC.

    EnumCommands Class

    Defines constants which are used to represent server commands.

  • 7/29/2019 Remote control desktop report

    9/21

    Java Remote Desktop Control

    SVERIs College of Engg. (Poly), Pandharpur9

    Code Snippets

    1) RemoteClient

    Connect to Server

    System.out.println("Connecting to server ..........");

    socket = new Socket(ip, port);

    System.out.println("Connection Established.");

    Capture Desktop Screen then Send it to the Server Periodically

    In ScreenSpyerclass, Screen is captured using createScreenCapturemethod in Robot class

    and it accepts a Rectangle object which carries screen dimension. If we try to send image object

    directly using serialization, it will fail because it does not implement Serializableinterface. That is

    why we have to wrap it using the ImageIconclass as shown below:

    while(continueLoop){

    //Capture screen

    BufferedImage image = robot.createScreenCapture(rectangle);

    /* I have to wrap BufferedImage with ImageIcon because* BufferedImage class does not implement Serializable interface

    */ImageIconimageIcon = new ImageIcon(image);

    //Send captured screen to the server

    try {System.out.println("before sending image");

    oos.writeObject(imageIcon);

    oos.reset(); //Clear ObjectOutputStream cacheSystem.out.println("New screenshot sent");

    } catch (IOException ex) {ex.printStackTrace();

    }

    //wait for 100ms to reduce network traffictry{Thread.sleep(100);

    }catch(InterruptedException e){

    e.printStackTrace();

    }

    }

    Receive Server Events then call Robot Class Methods to Execute these Events

    while(continueLoop){

    //receive commands and respond accordingly

    System.out.println("Waiting for command");int command = scanner.nextInt();

    System.out.println("New command: " + command);switch(command){

    case -1:

    robot.mousePress(scanner.nextInt());

    break;

  • 7/29/2019 Remote control desktop report

    10/21

    Java Remote Desktop Control

    SVERIs College of Engg. (Poly), Pandharpur10

    case -2:robot.mouseRelease(scanner.nextInt());

    break;case -3:

    robot.keyPress(scanner.nextInt());

    break;

    case -4:robot.keyRelease(scanner.nextInt());break;

    case -5:

    robot.mouseMove(scanner.nextInt(), scanner.nextInt());

    break;

    }

    }

  • 7/29/2019 Remote control desktop report

    11/21

    Java Remote Desktop Control

    SVERIs College of Engg. (Poly), Pandharpur11

    2) RemoteServer

    Wait for Clients Connections

    //Listen to server port and accept clients connectionswhile(true){

    Socket client = sc.accept();System.out.println("New client Connected to the server");

    //Per each client create a ClientHandler

    newClientHandler(client,desktop);

    }

    Receive Client Desktop Screenshots and Display them

    while(continueLoop){//Receive client screenshot and resize it to the current panel size

    ImageIconimageIcon = (ImageIcon) cObjectInputStream.readObject();

    System.out.println("New image received");

    Image image = imageIcon.getImage();

    image = image.getScaledInstance

    (cPanel.getWidth(),cPanel.getHeight(),Image.SCALE_FAST);//Draw the received screenshot

    Graphics graphics = cPanel.getGraphics();

    graphics.drawImage(image, 0, 0, cPanel.getWidth(),cPanel.getHeight(),cPanel);

    }

    Handle Mouse and Key Events then Send them to the Client Program to Simulate them

    In ClientCommandsSenderclass, when mouse is moved, x and y values are sent to the client but we

    have to take into consideration the size difference between clients' screen size and server's panel

    size, that is why we have to multiply by a certain factor as shown in the following code:

    public void mouseMoved(MouseEvent e) {

    doublexScale = clientScreenDim.getWidth()/cPanel.getWidth();

    System.out.println("xScale: " + xScale);doubleyScale = clientScreenDim.getHeight()/cPanel.getHeight();

    System.out.println("yScale: " + yScale);System.out.println("Mouse Moved");

    writer.println(EnumCommands.MOVE_MOUSE.getAbbrev());

    writer.println((int)(e.getX() * xScale));

    writer.println((int)(e.getY() * yScale));writer.flush();

    }

    public void mousePressed(MouseEvent e) {System.out.println("Mouse Pressed");writer.println(EnumCommands.PRESS_MOUSE.getAbbrev());

    int button = e.getButton();

    intxButton = 16;

    if (button == 3) {

    xButton = 4;}

    writer.println(xButton);

    writer.flush();

    }

  • 7/29/2019 Remote control desktop report

    12/21

    Java Remote Desktop Control

    SVERIs College of Engg. (Poly), Pandharpur12

    public void mouseReleased(MouseEvent e) {System.out.println("Mouse Released");

    writer.println(EnumCommands.RELEASE_MOUSE.getAbbrev());int button = e.getButton();

    intxButton = 16;

    if (button == 3) {

    xButton = 4;}

    writer.println(xButton);

    writer.flush();

    }

    public void keyPressed(KeyEvent e) {System.out.println("Key Pressed");

    writer.println(EnumCommands.PRESS_KEY.getAbbrev());

    writer.println(e.getKeyCode());

    writer.flush();

    }

    public void keyReleased(KeyEvent e) {

    System.out.println("Mouse Released");writer.println(EnumCommands.RELEASE_KEY.getAbbrev());

    writer.println(e.getKeyCode());

    writer.flush();

    }

  • 7/29/2019 Remote control desktop report

    13/21

    Java Remote Desktop Control

    SVERIs College of Engg. (Poly), Pandharpur13

    FUTURE ENHANCEMENTS

    The Technology is growing very fast and in the Networking environment the administrator

    had to control the whole thing. Remote system controlling has huge potential in the Internet-based and

    service-oriented architectures .To survive from the competition each system has to produce some

    modifications to it in the future. New features will provide the system a new fresh look, by which it can

    attract a lot of Administrators. Due to this reason it's necessary that the system need to be modified

    according to the users requirements. Some of the future enrichments are as follows

    > The utility at present meant for intranet environments and has a wide range of application areas like

    virtual classrooms

    > Next generation of this utility package is supposed on internet

    based applications

    > Further variations aim to include added capabilities such as controls and more user controls on

    Remote Machines

    > A request queue for the serverv to handle multiple simultaneous requests for the same file

    > Compressing the file before sending them to a requested system and

    decompressing on reception

  • 7/29/2019 Remote control desktop report

    14/21

    Java Remote Desktop Control

    SVERIs College of Engg. (Poly), Pandharpur14

    EXISTING SYSTEM

    Ample options are there in now a day s operating systems it to execute applications at the

    remote end. The basic services used by these operating systems today promote executions of the

    applications at the remote end with just restricted access.

    PROBLEMS WITH THE EXISTING SYSTEM

    > Administrator is not having full control

    > There is no provision to reboot or shutdown

    > Supports only one remote command on the remote machine at the same time

    > Never gets the feeling that we are using the remote machine

    > We cannot capture the remote systems Desktop

    2.3 ADVANTAGES AND DISADVANTAGES OF THE EXISTING SYSTEM

    Utilities like Telnet and remote control programs like Symantec's PC anywhere let you execute

    programs on remote systems, but they can be a pain to set up and require that you install client software

    on the remote systems that you wish to access. By using this users can save time by accessing data from

    remote systems. But using this all the users are not able to access the desktop of the remote machine

    The user will never get the feeling that they are working in the remote machine. Other problems are-

    Administrator is not having full control over the systems in the LAN. There is no provision to shutdown or

    reboot remote system. There is no way to use the processor of the remote machine directly

  • 7/29/2019 Remote control desktop report

    15/21

    Java Remote Desktop Control

    SVERIs College of Engg. (Poly), Pandharpur15

    CHAPTER 1

    1.1INTRODUCTION

    This program allows any computer to control other PCs remotely

    Remote DesktopControlleris a client-server software package allowing remote network

    access to graphical desktop. This software enables you to get a view of the remote machine

    desktop and thus control it with your local mouse and keyboard. It can be used to perform remote

    system control and Administration tasks in Unix, Windows and other assorted network

    environments.

    When the connection between a client and a server is first established, the server begins

    by requesting from the client , which typically results in the user being prompted for IP -

    addressthe client end. The server and client then exchange messages to negotiate desktop size

    and frame size.

    Fig. 1 Remote client and server connection

  • 7/29/2019 Remote control desktop report

    16/21

    Java Remote Desktop Control

    SVERIs College of Engg. (Poly), Pandharpur16

    Sr. No. Item 1 Item 2 Item 3

    Table. 1 Name ofTable (11-Italic)

  • 7/29/2019 Remote control desktop report

    17/21

    Java Remote Desktop Control

    SVERIs College of Engg. (Poly), Pandharpur17

    Conclusion

    Java Remote Desktop (jrdesktop) is an open source software for viewing and/or controlling adistance PC.

    Besides then screenshots, keyboard and mouse events transfer, jrdesktop includes manyadditional features (like: file transfer, data compression, color conversion, ...).

    jrdesktop uses RMI (Remote Method Invocation) with SSL/TLS to establish a securedconnection between the viewer and the server.

    Java Remote Desktop (jrdesktop) is intended to run across different platforms (based on JVM).

  • 7/29/2019 Remote control desktop report

    18/21

    Java Remote Desktop Control

    SVERIs College of Engg. (Poly), Pandharpur18

    A

    Project Report

    On

    Java Remote Desktop Control

    Submitted in partial fulfillment of the requirements for the award of the degree

    OF

    DIPLOMA

    INCOMPUTER ENGINEERING

    By

    Mr. DarshanDhanrajPurohit

    Mr. VinayVijaykumarMaslekar

    Mr. Amar Mohan Vasekar

    Mr. AmolSatyavanBandgar

    UNDER THE GUIDANCE OF

    Prof. Prashant S Bhandare

  • 7/29/2019 Remote control desktop report

    19/21

    Java Remote Desktop Control

    SVERIs College of Engg. (Poly), Pandharpur19

    DEPARTMENT OF COMPUTER ENGINEERING

    SHRI VITHAL EDUCATION & RESEARCH INSTITUTES

    COLLEGE OF ENGINEERING (POLYTECHINIC),

    PANDHARPUR.

    CERTIFICATE

    The Project report entitledJava Remote Desktop Control submitted by

    Mr. DarshanDhanrajPurohit

    Mr. VinayVijaykumarMaslekar

    Mr. Amar Mohan Vasekar

    Mr. AmolSatyavanBandgaris approved for Diploma in Computer Engineering from SVERISs College of

    Engineering (Polytechnic), Pandharpur.

    Name of Guide Name Of Project Co-ordinator

    (Prof. Prashant S Bhandare) (Prof S. S. Kadganchi)Department of Computer Engineering Department of Computer Engineering

    Prof. Kawale S. M. Prof. Misal N.D.

    (Head of Department) (Principal)

    Department of Computer Engineering

    Name of External Examiner - ________________________

    Sign of External Examiner - __________________________

  • 7/29/2019 Remote control desktop report

    20/21

    Java Remote Desktop Control

    SVERIs College of Engg. (Poly), Pandharpur20

    Date :

    Place :Pandharpur

    ACKNOWLEDGEMENT

    I take this opportunity to express my sincere thanks and deep

    sence of gratitude to my guide ,Prof. P. S. Bhandare for his constant

    support ,motivation, valuable guidance and immense help.

    During the entire course of this week. Without his\her constant

    encouragement, timely advice and valuable discussion, it would have

    been difficult in completing this work. I would also like to

    acknowledge Computer Engineering Department who provided me

    the facilities for completion of the project. I am thankful to him for

    sharing his\her experience in the research field with me and providing

    constant motivation during entire project.

    I would also like to express my gratitude to all my friends who

    helped me a lot for completion of my midterm project work.

    Mr. VinayVijaykumarMaslekar

  • 7/29/2019 Remote control desktop report

    21/21

    Java Remote Desktop Control

    SVERIs College of Engg. (Poly), Pandharpur21

    Features Basic Edition

    Communication through RMIMultiple Sessions

    Multiple User Interfaces

    Multihomed Server X

    Authentication X

    Encryption X

    File Transfer X

    Clipboard Transfer X

    Color Quality X

    Image Quality X

    Data Compression X

    Screen Functions X

    Control Functions X

    Connection Details X

    Remote Host Properties X