HP-UX Reference (11i v2 07/12) - 3 Library Functions N-Z (vol 7)

r
rexec(3N) rexec(3N)
Lost connection
The program attempts to read from the socket and fails. This means the socket connection with the
remote host was lost.
.netrc: message
Error in opening .netrc file in the home directory for a reason other than the file not existing.
Error - .netrc file not correct mode. Remove password or correct mode.
The .netrc file is readable, writable or executable by someone other than the owner.
Next step: Check whether .netrc has been modified by someone else and change the mode of
.netrc (chmod 400 .netrc).
Unknown .netrc option keyword
An unrecognized keyword has been found in
.netrc (see netrc(4)).
Next step: Correct the keyword in
.netrc
.
primary connection shutdown
While waiting for the secondary socket to be set up, rexec() had its primary connection shut down.
This may have been caused by an inetd security failure (see inetd(1M)).
recv: message
While trying to set up the secondary (stderr) socket, rexec() had an error condition on its pri-
mary connection.
accept: Interrupted system call
While trying to set up a secondary socket, rexec() ran out of a resource, which caused the accept to
time out.
Next step: Repeat the command. If a timeout occurs, check whether the Internet Services are
installed and inetd is running.
EXAMPLE
To execute the date command on remote host hpxzgy using the remote account chm,
rexec() is
invoked as follows:
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
char *host[] = { "hpxzgy" };
char *user = "chm";
char *passwd = "password";
char *cmd = "date";
main(argc, argv)
char **argv;
int argc;
{
char ch;
struct servent *servent;
FILE *fp;
int sd;
servent = getservbyname("exec", "tcp");
sd = rexec(host, servent->s_port, user, passwd, cmd, 0);
fp = fdopen(sd, "r");
while ((ch = getc(fp)) != EOF)
putchar(ch);
}
318 Hewlett-Packard Company 2 HP-UX 11i Version 2: December 2007 Update