#include using namespace std; // This is an example program that shows how to issue commands to // a remote computer and receive the results programmatically. // // The current reason for this is to help coordinate programs running // on a Linux desktop and a VxWorks system without having to write // an entire client server system and have the server always running // on the VxWorks machine. // // The main idea with this method is to create a couple of pipes // that can be used to redirect the stdin and stdout of the // remote shell process (telnet, rsh, ssh, ...whatever) to this // program so they can be read and written to by read() and write(). // // This is accomplished by first setting creating the pipe, then // forking this process into 2 processes, then having the "child" // fork replace his stdin, stdout pipes with the newly created ones, // and finally having the child "exec" itself into the remote // shell program. Since the remote shell will inherit its stdin // and stdout streams from the fork, it will use the pipes we setup // for that purpose. Cool huh? #include #include #include #include #include #define _DBG_ cout<<__FILE__<<":"<<__LINE__<<" " #define _DBG__ _DBG_<