The rexec() call allows command processing on a remote host.
Syntax
#include <utils.h> int rexec(host, port, user, passwd, cmd, err_sd2p) char **host; int port; char *user, *passwd, *cmd; int *err_sd2p;
Parameters
host
getservbyname("exec","tcp")
When directly specifying an integer for the port, specify it in Network Byte order, obtainable by using the htons() function call. user
Description
The rexec() call allows the calling process to start commands on a remote host.
If the rexec() connection succeeds, a socket in the internet domain of type SOCK_STREAM is returned to the calling process and is given to the remote command as standard input and standard output.
Return Values
When successful, the call returns a socket to the remote command.
When unsuccessful, the call returns a value of -1, indicating that the specified host name does not exist.
Examples
int normsock;char *host = NULL, *luser = NULL, *password = NULL, *cmd; struct servent *sp; sp = getservbyname("exec", "tcp"); host = "remote _host"; luser = "my _userid"; password = "my _password"; cmd = "rempte_host_cmd"; normsock = rexec(&host, sp->s_port, luser,password, cmd, &errsock); if (normsock == -1) exit(-1);
Related Calls