Final Project - Simple Remote Desktop, SRD Seiya Kawashima December 10, 2007 1 Introduction On this project, I wrote a remote desktop program using some well known codes and my own ideas. As you can see, the architecture of my remote desktop is quite straight forward. The technologies, RMI and RTP make this remote desktop work well over the Internet. I m going to talk about the architecture, the results from some experiments and finally my conclusion.here is an overview of my solution. Figure 1: Overview of Final Project 1
2 BEHIND THE SCENE 2 2 Behind the scene There are essential factors that make the remote desktop work, so I show them here as things behind the scene. Remote Method Invocation, RMI This is basically a remote procedure call. When we want to use RMI, we register interfaces that have methods which we want to invoke remotely and put them and their implementations on a place where clients can access anywhere in the world. After these steps, clients access the registry to look up the methods and invoke the methods that they want. These mechanisms make the remote desktop work. Robot class below takes care of the mouse actions and typing characters, but we need a way to send these messages to the server. RMI does the job. So I use RMI to invoke Robot class s methods remotely. Real Time Transport Protocol, RTP This protocol is invented for realtime streaming on the Internet.Real-time streaming means video conferencing and VoIP applications. These applications can t delay to deliver data but drop some data. There is a Java framework called Java Media Framework implementing RTP for the applications. I used the protocol to deliver the server s screen to the client implementing the framework. java.awt.robot, Robot class This class is originally written for automated tests. It means that when we want to test programs, we make a program which implements this class to test them. This class has methods for typing characters, moving the mouse, wheeling the mouse and capture the screen. What the class differentiates from others is about the mouse actions. There are other classes that deal with the position of the mouse on the screen. They also calculate the position, but they don t move the mouse actually. So even though we want to click a button or move the mouse on a test, we can t accomplish the task. Here is a trick about how to move the mouse and type characters on another screen remotely.
3 HOW IT LOOKS LIKE 3 3 How it looks like Here is a screen shot of the program. On this figure, the client which has a window (JFrame) is on Mac OS X, and the server which is shown on the window is on Windows 2000. Figure 2: Remote desktop screen 4 Results On this section, I show you some interesting data about how much traffic there is before the session, while the session, and while the session with the mouse and keyboard actions. And also there is information about how long it takes to invoke remote methods on the program. With these data, we can find out that how good and bad the performance is. Here is a table for traffic before the session starts (Initial state).
4 RESULTS 4 In (download) Traffic/sec Peek/sec Average/sec Total Traffic/sec Peek/sec Average/sec Total 0B 4KB 3KB 24KB 0B 4KB 16KB 4MB Out (updload) 0B 298B 176B 352B 0B 391B 378KB 107MB Table 1: Client on the left, Server on the right Here is a table for traffic when the session initiated (just connected each other). In (download) Traffic/sec Peek/sec Average/sec Total Traffic/sec Peek/sec Average/sec Total 437KB 583KB 349KB 46MB 128B 29KB 16KB 5MB Out (updload) 100B 40KB 13KB 770KB 433KB 536KB 384KB 160MB Table 2: Client on the left, Server on the right Here is a table for typing characters, clicking the mouse and moving the mouse wheel. In (download) Traffic/sec Peek/sec Average/sec Total Traffic/sec Peek/sec Average/sec Total 376KB 583KB 349KB 114MB 10KB 29KB 14KB 5MB Out (updload) 10KB 40KB 10KB 1MB 368KB 536KB 378KB 204MB Table 3: Client on the left, Server on the right Next, I m going to show you how long it takes to do normal actions such as moving the mouse and transferring files. These data helps us to measure the performance.here is a table for how long to move the mouse remotely and transfer a file.
5 FUTURE WORK 5 Each Action Time (sec) Mouse movement 0.12 Typing characters 0 (infinitely close to zero) File transfer(size: 61.4KB) 7.45 File transfer(size: 4.97MB) 331.086 4.1 Advantage Table 4: Actions on the session Those results above tell us an advantage of the remote desktop. Moving the mouse and typing characters are fast enough to use in the real world. Of course, there is some latency between invoking the events and being executed, but the performance is good enough. Another advantage is that this is a totally free open-source program, so if people want to modify and/or change some functions and/or extend it however they want. I think that this usability is quite nice. Because I know there are so many people who want to see a sample remote desktop which works good enough to use personally like I do. For them, the point works well, and also I know the fact that there are not so many sample remote desktop programs WITH the source codes in Java for free. 4.2 Disadvantage Transferring files is quite slow. The reason is that to use RMI for transferring data, I construct byte arrays of transferred files on the client and send them as byte arrays to the server.file class that we usually use to deal with files in Java can t be used remotely since File class can only see in the local file system, and but in another one.and then The server reconstructs files from the byte arrays. These processes have to be paid for a price when we want to deal with data transfer using RMI. 5 Future work My solution still lacks of functions that we usually use. On the other hand, the performance can be improved. I list them as future work here.
5 FUTURE WORK 6 Pin point Drag and Drop People usually use this function to copy files or directory from one place to another. This function should be implemented correctly in my solution. Since my solution uses File class to make a place where you want to put chosen files, there is no way to the target on runtime.this point should be improved. Drag and Drop directories remotely People use the function not only to cop files but also directories, but my solution doesn t support currently because of using File class. File class can t search for a file or directory remotely. The file or directory that you want to deal with have to be in the file system, but in another file system.that s why it is impossible to implement this function with File class. screen resolution Throughout my experiments, my solution doesn t support wide screen monitors. when I use a wide screen monitor to test the program, I can t move the mouse the very right hand side on the screen. JMF is the core part for taking care of the screen, so I should change the implementation. Through SSL People need to use this protocol to make sure inbound and outbound packets are encrypted. So other people can t actually your raw traffic. My solution doesn t support this function, but it can be done easily using RMI factory with SSL. This function can be implemented soon. Faster transferring Now the program uses byte arrays to transfer files remotely. This has to be done with RMI, but it makes the program work slowly. An alternative can be to use SocketStream for transferring like putting files or directories on the stream and transfer them to the target computer. The way can be a lot faster. More practical with Multimedia Since this solution uses JMF that we can deal with live music and video implementing the gigantic framework. So it means that I could play video/audio streams remotely and then play it locally. If so, managing computers remotely is easier than it is, because people could talk while fixing problems remotely. Interactivity is also important.
6 CONCLUSION 7 6 Conclusion Throughout this project, there are many things that I ve learned such as how difficult modifying people s codes, to use RMI for distributing programs, classes that I ve never used and also the limitations of Java.This time I started the project as soon as possible and used a lot of time, so mostly I was on schedule. Demonstrations of what we ve written are as important as presentations are. That s the easiest way to convince people what you ve gotten, written and how your programs work. On this phase, I lost the opportunity. This was a disaster to me and people who were expecting my demos. For the future, I think that testing codes as many times as possible is needed and also checking and testing the environment where you are demonstrating are also what I should do unless my programs won t persuade. This was a good practice for the future, so I will do that. 7 Reference References [1] Generating Live Audio/Video Data http://java.sun.com/products/java-media/jmf/2.1.1/solutions/livedata.html ( I used this example to get the screen shots) [2] Transmitting Video over RTP http://java.sun.com/products/java-media/jmf/2.1.1/solutions/videotransmit.html (I modified this example to fit my needs. [3] JMF Java Media Framework documentation [4] Java Swing Marc Loy, Robert Eckstein, Dave Wood, James Elliton & Brian Cole [5] Core Java 2 Volume 1 - Foundamentals Cay S. Horstmann, Gary Cornell [6] Core Java 2 Volume 2 - Advanced Features Cay S. Horstmann, Gary Cornell
REFERENCES 8 [7] Introduction to the Java Robot Class in Java http://www.developer.com/java/other/article.php/2212401