You are on page 1of 10

Aim and Objective Our Project allows any computer to control other PCs remotely.

Main Program Features


View remote desktop Mouse movement control Mouse buttons control Keyboard control

Background One of the biggest challenges in our project is finding a way to move the mouse pointer, simulate key stroke and capture the screen. A a great class, Robot class that does all that our Project need. In addition, using serialization to send screenshots from client to server and to send server events like mouse move, key press, key release 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

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 we move the mouse over the frame, this results in moving the mouse at the client side. The same happens when we 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.

How To Use Our Project: In order to run Our Project WE Need: 1>Run The Server Code: This will ask to enter port number for the server to listen at, enter any port number above 1024, for example 5000. On the other PC say PC2execute client Programme: This will ask to enter server IP, enter IP address of PC1, then askes to enter port number, enter the same port we entered above, e.g. 5000. Now, in PC1 We have full control over PC2 including moving the mouse, clicking the mouse, keys stroking, viewing PC2 desktop, etc. Coding Structure Of Our Project: 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 InternalFrame per 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. 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.

Problem Selection : TeamViewer may be installed with an installation procedure, although the 'Quick Support' version .To connect to another computer, TeamViewer has to be running on both machines. To install TeamViewer administrator access is required, but once installed it can be run by any user. When TeamViewer is started on a computer, it generates a partner ID and password (userdefined passwords are also supported). To establish a connection from a local client to a remote host machine, the local operator must communicate with the remote operator, request the ID and password, then enter these into the local TeamViewer To start an online meeting the presenter gives the Meeting ID to their participants. They join the meeting by using the TeamViewer.[11] It is also possible to schedule a meeting in advance.]

Feasibility study Feasibility study encompasses the following things: Technical Feasibility Operational Feasibility Economical Feasibility

3.3.1Technical Feasibility: Technical feasibility determines whether the organization has the technology and skills necessary to carry out the project and how the technology and skills necessary to carry out the project and how should this is obtained. The system can be technically feasible because of the following grounds. All necessary technology exists to develop the system. The existing resources are capable and can hold all the necessary data. The system is too flexible and it can be expanded further. The system can give guarantees of accuracy, ease of use, Reliability and the data security. The system can give instant responses to inquiries. So TeamViewer can conclude that the system is technically feasible.

3.3.2 Operational Feasibility: Operational feasibility determines if the proposed system satisfied user objectives and can be fitted into the current system operation. The present system Distribution management system can be justified as operationally feasible based on the following grounds. The methods of processing and presentation are completely accepted to the administrator since they can meet all the requirements. The administrator has been involved in the planning and development of the system. The proposed system will not cause any problem under any circumstances. Is proposed system will certainly satisfy the user objectives and it will also enhance their capability. The proposed system can be best fitted into current operation. Also there is no need to replace any existing staff. Therefore the system is operationally feasible.

3.3.3 Economical Feasibility: Economical feasibility determines whether projects goal can be within the resource limits allocated to it. It must determines whether it is worthwhile to process with the project all or whether the benefits obtained from the new system is not worth the costs. After conducting cost benefit analysis, it reveals that the objectives of the proposed system can be achieved within the allocated resources. Proposed system requires no extra manpower, cost almost nil. Also the cash invested to implement the proposed system can be easily recoverable. So the system is economically feasible.

System Analysis System Analysis 4.1 Requirement Specification Software Requirements Specification plays an important role in creating quality software solutions. Specification is basically a representation process. Requirements are represented in a manner that ultimately leads to successful software implementation. Requirements may be specified in a variety of ways. However there are some guidelines worth following: Representation format and content should be relevant to the problem Information contained within the specification should be nested Diagrams and other notational forms should be restricted in number and consistent in use. Representations should be revisable.

4.1.1 Software Requirements Specifications: The software requirements specification is produced at the culmination of the analysis task. The function and performance allocated to the software as a part of system engineering are refined by establishing a complete information description, a detailed functional and behavioral description,

and indication of performance requirements and design constraints, appropriate validation criteria and other data pertinent to requirements. An outline of the Software Requirements Specification: A simplified outline can be given for the framework of the specifications. This is according to the IEEE Standards.

4.1.2 Implementation Tools & Language JAVA EDITOR (NET BEANS) System Design: Database Design: Our Database is on MySql Because To Access the teamviewer main form we should have to first login: Thus the registration table include following fields: 1>UserName varchar(5) 2>password varchar(50) 3>EmailId varchar(50) 4>Contact varchar(50) 5>Addres varchar(50) Program Design: 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 ScreenSpyer class, Screen is captured using createScreenCapture method 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 Serializable interface. 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 */ ImageIcon imageIcon = new ImageIcon(image); //Send captured screen to the server try { System.out.println("before sending image"); oos.writeObject(imageIcon); oos.reset(); //Clear ObjectOutputStream cache System.out.println("New screenshot sent"); } catch (IOException ex) { ex.printStackTrace(); } //wait for 100ms to reduce network traffic try{ 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; 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;

2) RemoteServer Wait for Clients Connections //Listen to server port and accept clients connections while(true){ Socket client = sc.accept(); System.out.println("New client Connected to the server"); //Per each client create a ClientHandler new ClientHandler(client,desktop); } Receive Client Desktop Screenshots and Display them while(continueLoop){ //Receive client screenshot and resize it to the current panel size ImageIcon imageIcon = (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 ClientCommandsSender class, 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) { double xScale = clientScreenDim.getWidth()/cPanel.getWidth();

System.out.println("xScale: " + xScale); double yScale = 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(); int xButton = 16; if (button == 3) { xButton = 4; } writer.println(xButton); writer.flush(); } public void mouseReleased(MouseEvent e) { System.out.println("Mouse Released"); writer.println(EnumCommands.RELEASE_MOUSE.getAbbrev()); int button = e.getButton(); int xButton = 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(); }

You might also like