Networking multiple computers to one brain in Java
I was wondering which libraries or API's would be useful in this. what im aiming for is to be able to type a 开发者_Python百科command into a prompt and then specify which computer(out of all of them that are networked together) to execute that command on. the second part is i want to be able to see that command execute and the result on the computer that was specified.
for example if i enter "firefox www.google.com, desktop2" i want to be able to see the window open on the monitor of that computer. Do you understand what im trying to do? any help is appreciated.
Thanks, Morpheous
I think I do, but not why. For example, there are existing mechanisms for doing this. If you've got sshd running on each of your "multiple computers" you could simply, from "control", run:
ssh -X user@desktop2 firefox www.google.com
and you'd use remote X to forward firefox back to your local desktop (actually being executed on desktop2). Try man ssh
for more information and ask on serverfault if you want to know more.
If you're looking to develop something that achieves this sort of idea, that's a different matter and I'd question if Java is the best way to do it (opinions vary but it's not a "systems language"). Again, existing solutions exist such as the build systems used for projects like Fedora (see Koji).
My advice would be to research a lot of existing code and only if this doesn't solve your problem or if you want a challenge, write something new.
On Windows, PSExec will do that:
The command line is
Usage: psexec [\\computer[,computer2[,...] | @file]
[-u user [-p psswd]][-n s][-l][-s|-e][-x][-i [session]]
[-c [-f|-v]][-w directory][-d][-<priority>][-a n,n,... ]
cmd [arguments]
For example:
psexec \\computer2 -i firefox.exe www.google.com
Will execute firefox interactively on the remote computer.
See - PSExec, Microsoft PStools
精彩评论