Solved

Remote Execution

Posted on 1998-09-29
7
244 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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.

762 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