kanthrc has asked for the wisdom of the Perl Monks concerning the following question:

Hi all, I posted the same topic on PerlMonks google group and one more group comp.lan.perl.modules. But I dint get to see any replies. My problem is: I am trying to write a client-server application to automate some of the testing activities. We have a setup of 100 clients in our test lab. We use these clients to stress servers over the network. Whenever we need to stress a server we just get that server in to our test network and from the clients we login to the clients and open one application that is used to stress the servers over network. This has to be done manually on each of the clients. Remember, there are 100 clients and it is not an easy job to do..!! Now, I want to write an application in such a way that all the clients should be listening to one controller and whatever mouse & keyboard inputs on the controller should be sent to the clients. Simple example would be, if I open notepad.exe on my controller, the same should be opened on all my clients also. Do you guys know any open source application (written using Perl) that can do this? Or if I have to write it on my own, are there any classes that I can use? Thanks in advance for your time, Ravi

Replies are listed 'Best First'.
Re: Remote Keyboard and Mouse IO
by Joost (Canon) on Feb 24, 2005 at 14:49 UTC
    Hello, please see How (not) to ask a question. (update: this link seems to be more relevant).
    • We have a setup of 100 clients in our test lab.
      What kind of clients? are these windows pcs? If so, what version of windows?
    • Whenever we need to stress a server we just get that server in to our test network and from the clients we login to the clients and open one application that is used to stress the servers over network.
      What kind of server? See remark above. What kind of network protocol do you use? SMB, VNC, rdesktop, custom client software, what?
    • Now, I want to write an application in such a way that all the clients should be listening to one controller and whatever mouse & keyboard inputs on the controller should be sent to the clients.
      That does not sound like a very good idea to me: generally you can't send the same mouse input to a different machine and expect to click on the same application (unless you take extreme care).
    • Simple example would be, if I open notepad.exe on my controller, the same should be opened on all my clients also.
      This expected behaviour is contrary to your expected solution.
    • are there any classes that I can use?
      Yes. Try Win32::API.

    I'm assuming a lot here.

    I would think it would be a lot easier to write a script that uses Win32::API, Win32::GuiTest or some module like that, install it on a network filesystem that all the clients can read, and start the script on each client (maybe using some kind of network activation, so you can control them from one machine).

    Possibly, you can use a much more elegant/efficient solution, but you don't really give us a lot of clues how.

      Hi,
      Sorry for neglecting the basics of posting a question..!! Anyways, I will try and explain my problem better this time.

      1. I have 100 Windows XP clients and we usually test OSes like Windows Server, Netware and Linux.
      2. When we have to test Netware, we usually logon to one client and access other clients using remote desktop protocol and then open an in-house developed application that stresses the server over network. This piece of software uses TCP to communicate with the server. All we need to do now is from each client logon to Netware NDS using Netware client for windows and then use the above mentioned software to stress the server.
      3. When I said that I want to send the same keyboard and Mouse inputs to all the clients, I presumed that all the clients have same resolution and same set of applications installed so that there is no mismatch in the menu options that I would actually see.
      4. There is, absolutely, no contrary between what I wanted to achieve and what I quoted as an example. All I meant was, I expect notepad application to be opened on all my clients if I open notepad application (either by clicking on start -> accessories -> etc., or typing notepad.exe at the command prompt) at the controller machine. This eventually means that my controller is able to send the kbd/mouse inputs to all the clients.

      I'm assuming a lot here.

      I hope that I have answered most of your questions.

      I would think it would be a lot easier to write a script that uses Win32::API, Win32::GuiTest or some module like that, install it on a network filesystem that all the clients can read, and start the script on each client (maybe using some kind of network activation, so you can control them from one machine). Possibly, you can use a much more elegant/efficient solution, but you don't really give us a lot of clues how.

      Yes. I want a better solution than using Win32::GuiTest. I want my solution to be more generic between operating systems. I expect the same solution with some modifications to work with any OS. I know it is pretty much do-able. I started my work on this. I will keep you guys updated.
      Thanks,
      ravi
        It's probably possible to use the scenario you suggested if you can set up all the clients exactly the same. This also means: make sure nobody moves ANY application window or desktop icon on any client, or installs extra software on seperate clients (if it means extra "start-menu" items) because that will break your mouse input. I would consider this too easy to break, and too annoying to check and fix when it breaks.

        The reason I suggested Win32::GuiTest was not to stress the servers directly, but to control the client applications that stress the server, instead of using mouse/keyboard input. Since you're only using win32 clients anyway, the windows specific nature of the module doesn't matter.

        Ofcourse this would probably mean spending extra time writing the test scripts, but you only have to do that once for every scenario, you can probably reuse a lot of code for different scenarios, and you then have an automated solution that can basically run unattended, whenever you want to, and it will probably be a lot more robust than trying to keep 100 clients completely in sync.

        By the way, I've just seen a demonstration of Win32::IE::Mechanize which looks neat if you need to test webapps that use a lot of javascript.

        update: if you're using an in-house developed app to stress the server, you can probably make that application more easy to control from scripts. You could even consider embedding a perl interpreter in it. See perlembed.