Solved

Remote Execution

Posted on 1998-09-29
7
240 Views
Last Modified: 2013-12-26
Is there and easy way to execute a program on a unix machine
from within a c++ program on another unix machine?
Basically I have an X windows program that needs to open an
X Display that runs on another machine?
Thanks
0
Comment
Question by:soucy
  • 3
  • 3
7 Comments
 
LVL 2

Expert Comment

by:mlev
ID: 1293460
I think your best bet would be system("rsh ...")
(or fork() + execlp("rsh", ...))
If you want to work harder, you might write a daemon
to run on the remote machine, wait for connection from
your program and then launch something.
0
 
LVL 3

Expert Comment

by:braveheart
ID: 1293461
mlev's suggestion looks good to me. Don't forget to use xhost appropriately to set permissions for the display on which the client will run.
0
 
LVL 1

Accepted Solution

by:
vulkanr earned 10 total points
ID: 1293462
if i understood your question correctly,
mlev is wrong. rsh will work on a workstation but if your
client is a X-TERM or a PC running some kind of X-emulator,
rsh is useless.
i suggest you "setenv" the DISPLAY enviroment variable to the
address of the remote machine client. (use putenv from within your program). then, every X program you will run will write
its output to the display of the remote machine.

0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 2

Expert Comment

by:mlev
ID: 1293463
vulkanr, read the question carefully: "...a program on a unix[!] machine from within a c++ program on another unix[!] machine."

0
 
LVL 1

Expert Comment

by:vulkanr
ID: 1293464
mlev, sure its a unix machine, but the problem described, is opening a display (A x-client), not running a remote program.

however, the answer i suggested would run over the local server.
i guess the right answer will be a combined one,
set the DISPLAY variable, then "rsh" to the remote server, and execute the desired program.

0
 
LVL 1

Expert Comment

by:vulkanr
ID: 1293465
mlev, sure its a unix machine, but the problem described, is opening a display (A x-client), not running a remote program.

however, the answer i suggested would run over the local server.
i guess the right answer will be a combined one,
set the DISPLAY variable, then "rsh" to the remote server, and execute the desired program.

0
 
LVL 2

Expert Comment

by:mlev
ID: 1293466
More like rsh to the remote server, set DISPLAY there, and execute it. Or execute it with -display option or whatever.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question